Rule: No primary key attribute can have a null value.
Example: In the table where SID is the primary key, every SID must have a value. So, having a null value for SID is not allowed.
SID
Name
Class (semester)
Age
8001
Ankit
1st
19
8002
Srishti
1st
18
8003
Somvir
4th
22
8004
Sourabh
6th
A
Referential Integrity Constraint:
Rule: If a foreign key in one table refers to the primary key in another table, every foreign key value must either be null or exist in the referenced table.
Example: In the second table, the DNO (Department Number) is a foreign key that refers to the DNO in the third table. Every DNO in the second table must be either null or match a DNO in the third table.
ENO
NAME
Age
DNO
1
Ankit
19
10
2
Srishti
18
11
4
Sourabh
22
14
DNO
D.Location
10
Rohtak
11
Bhiwani
12
Hansi
Domain Constraints:
Rule: Specifies the allowed set of values for an attribute based on its data type.
Example: If the Age attribute is defined as an integer, then every value in the Age column must be a valid integer.
SID
Name
Class (semester)
Age
8001
Ankit
1st
19
8002
Srishti
1st
18
8003
Somvir
4th
22
8004
Sourabh
6th
A
These constraints help maintain the accuracy, consistency, and reliability of data in a database.