What is a constraint? and its various types.

Answer

Constraints are the rules enforced on the data columns of a table. These are used to limit the type of data that can go into a table. This ensures the accuracy and reliability of the data in the database.

If any interruption occurs between the constraint and data action, the action is failed. Some of the most commonly used constraints are NOT NULL, PRIMARY KEY, FOREIGN KEY, AUTO_INCREMENT, UNIQUE KEY, etc.

syntax  to create a constraint for a table:

 CREATE TABLE
 table_name (  column1 datatype constraint,   column2 datatype constraint,  ....);    
 

SQL categories the constraints into two levels:

Column Level Constraints: These constraints are only applied to a single column and limit the type of data that can be stored in that column.

Table Level Constraints: These constraints are applied to the entire table and limit the type of data that can be entered.

All sass Questions

Ask your interview questions on sass

Write Your comment or Questions if you want the answers on sass from sass Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---