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.
2 thoughts on “Explain the following constraints : i. Entity integrity constraint. ii. Referential integrity constraint. iii. Domain constraint.”
Your article broadened my perspective on how to make the most of traveling and taught me things I didn’t know before. I appreciate the time and effort you put into sharing this knowledge with us. We talked about a similar topic about solo travel experiences on TravelForums. I’m eager to see what else you’ll share!
I always spent my half an hour to read this web site’s articles everyday
along with a mug of coffee.!
Your article broadened my perspective on how to make the most of traveling and taught me things I didn’t know before. I appreciate the time and effort you put into sharing this knowledge with us. We talked about a similar topic about solo travel experiences on TravelForums. I’m eager to see what else you’ll share!
I always spent my half an hour to read this web site’s articles everyday
along with a mug of coffee.!