- The Set of rules which is used to maintain the quality of information are known as integrity constraints.
- Integrity constraints make sure about data intersection, update and so on.
- Integrity constraints can be understood as a guard against unintentional damage to the database.
Different types of Integrity Constraints
- The Definition of an applicable set of values is known as domain constraint.
- Strings, character, time, integer, currency, date etc. Are examples of the data type of domain constraints.
‘Twenty two’ is not allowed for 104 id because the attribute AGE is an integer
Entity Integer Constraint
- Entity Integrity Constraints states that the primary value key cannot be null because the primary value key is used to find out individual rows in relation and if the value of the primary key is null then it is not easy to identify those rows.
- There can be a null value in the table apart from the primary key field.
Null is not allowed in Emp_ID as it is a Primary key and cannot have a NULL value.
Referential Integrity Constraint
- Referential Integrity Constraint is specific between two tables.
- A foreign key in the 1st table refers to the primary key of the 2nd table, in this case each value of the foreign key in the 1st table has to be null or present in the 2nd table.
- The Entity within its entity set is identified uniquely by the key which is the entity set.
- There can be a number of keys in an entity set but only one will be the primary key out of all keys. In a relational table a primary key can have a unique as well as a null value.
All row ID must be unique hence 102 is not allowed.