Constraints used to stop invalid data entry into table. Constraints are created on table column.
Types of the constraints:
1) Not null -
Not accept null values but will accept duplicate values.
Not null constraints does not support table level.
2) Unique -
Unique constraints does not accept duplicate values but will accept null values.
Unique constraints support column level, table level.
3) Primary key -
Primary key is used for identifying row uniquely in a table.
Primary key does not accept duplicate values, null values.
There can be only one primary key in a table. primary key support column level, table level.
Composite primary key -
Common primary key for multiple columns is called composite primary key.
4) Foreign key -
If you want to establish relationship between tables then we must use referential integrity constraint foreign key.
One table foreign key must belongs to another table primary key and primary key, foreign key column must belong to same datatype. foreign key accept duplicate, null values. foreign key support column level, table level.
5) Check constraint -
Check constraints used to define logical condition according to client business rule. check constraints does not work with sysdate.
Please do check our daily posts, videos for beneficial informations, in case of any additional queries please do contact us, we are happy to assist you.
https://www.youtube.com/a4uofficial
0 Comments