AdBlock Detected!
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.
SQL Check |
|
SQL > Constraint >
CHECK Constraint
The CHECK constraint ensures that all values in a column satisfy certain conditions. Once defined, the database will only insert a new row or update an existing row if the new value satisfies the CHECK constraint. The CHECK constraint is used to ensure data quality. The SQL CHECK constraint enforces a Boolean condition on column values at insert/update time, rejecting any data that fails the rule and keeping your table clean and consistent.
For example, in the following CREATE TABLE statement, Column "SID" has a constraint -- its value must only include integers greater than 0. So, attempting to execute the following statement, will result in an error because the values for SID must be greater than 0. Please note that the CHECK constraint does not get enforced by MySQL at this time. Frequently Asked QuestionsQ: What does the SQL CHECK constraint do? Q: Does MySQL enforce the CHECK constraint? Q: Can a CHECK constraint reference multiple columns? Q: How is CHECK different from NOT NULL? |
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.