CHECK Constraint in SQL - sql - sql tutorial - learn sql

 check constraints of sql
  • The CHECK constraint is used to limit the value range that can be placed in a column.
  • If you define a CHECK constraint on a single column it allows only certain values for this column.
  • If you define a CHECK constraint on a table it can limit the values in certain columns based on values in other columns in the row.
  • The CHECK constraint ensures that all values in a column satisfy certain conditions.
  • 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.
  • For example, in the following CREATE TABLE statement,
(SID integer CHECK (SID > 0), 
Last_Name varchar (30),  
First_Name varchar(30));
  • Column "SID" has a constraint - its value must only include integers greater than 0. So, attempting to execute the following statement,
INSERT INTO Student VALUES (-3, 'wikitechy', 'Tutorials');
  • 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.
 process of check constraint in sql

This tutorial provides more the basic needs and informations on sql tutorial , pl sql tutorial , mysql tutorial , sql server , sqlcode , sql queries , sql , sql formatter , sql join , w3schools sql , oracle tutorial , mysql , pl sql , learn sql , sql tutorial for beginners , sql server tutorial , sql query tutorial , oracle sql tutorial , t sql tutorial , ms sql tutorial , database tutorial , sql tutorial point , oracle pl sql tutorial , oracle database tutorial , oracle tutorial for beginners , ms sql server tutorial , sql tutorial pdf

Related Searches to Check Constraint in SQL