Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6026881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:30:35+00:00 2026-05-23T04:30:35+00:00

I would like to restrict a column value in a table. For example, the

  • 0

I would like to restrict a column value in a table. For example, the column values can only be car or bike, or van. My question is how do you achieve this in SQL, and is it a good idea to do this on the DB side or should I let the application restrict the input?

I also have the intention to add or remove more values in the future, for example, truck.

The types of Databases I am using are SQLite and MySQL.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:30:36+00:00Added an answer on May 23, 2026 at 4:30 am

    Add a new table containing these means of transport, and make your column a foreign key to that table. New means of transport can be added to the table in future, and your column definition remains the same.

    With this construction, I would definitively choose to regulate this at the DB level, rather than that of the application.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to restrict the contents of a TextBox to contain only five
I have a class and I would like to restrict its instantiation to only
I would like to restrict sending email to only a few addresses. My idea
I would like to restrict access to my /admin URL to internal IP addresses
I would like to restrict the fields while creating a new post in WordPress.
I would like to restrict WPF AutoCompleteBox (wpf toolkit control) to select an item
I would like to get a sum from a column, with and without a
my Message Driven Bean executes highly intensive operations so I would like to restrict
I would like to use @Restrict in seam application. One of my scenario contains
I have a view like this: CREATE VIEW MyView AS SELECT Column FROM Table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.