Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Explain the following constraints : i. Entity integrity constraint. ii. Referential integrity constraint. iii. Domain constraint.

Entity Integrity Constraint:

  • 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.
SIDNameClass (semester)Age
8001Ankit1st19
8002Srishti1st18
8003Somvir4th22
8004Sourabh6thA

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.
ENONAMEAgeDNO
1Ankit1910
2Srishti1811
4Sourabh2214
DNOD.Location
10Rohtak
11Bhiwani
12Hansi

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.
SIDNameClass (semester)Age
8001Ankit1st19
8002Srishti1st18
8003Somvir4th22
8004Sourabh6thA

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.”

  1. 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!

  2. I always spent my half an hour to read this web site’s articles everyday
    along with a mug of coffee.!

Leave a Comment