sql - How do I limit the acceptable values in a database column to be 1 to 5? -
I have a table in the database where one of the columns must have values from 1 to 5. How can I write this limitation in the database? Do I use an obstacle?
You need to add an obstacle to your table, designated a better :
Yourchem.YourTable ADD CONSTRAINT CHK_YourTable_YourColumn_ValidLimits check (between your columns 1 and 5)
Create your schema Your table (Your column is not INT, tap contract CHK_Your Tables_your column_valititative check (1 and 5 between your columns), some other columns VARCHAR (10));
The best practice is to clearly name your obstacles.
Comments
Post a Comment