Let us understand the concept of Entity Integrity and Referential Integrity. Before proceeding further, we recommend to read these article for better understanding:
Table of Contents
Entity means any place, thing or person in database. An entity represents a real world object. Each table represents an entity and each row in a table is the instance of entity.
Entity Integrity constraint uniquely identifies each row in table. Primary key assures the entity integrity constraint is applied to a table.
It also states that value in primary key fields cannot be null.
For example, Let us take example of table Employee having columns: Emp_Id, Name, Address, Pincode, Passport_Number, Salary.
Let’s say Emp_Id is primary key in the table. Thus from the definition of Entity Integrity, the value of Emp_Id cannot be null as it unique identifies an employee record in the table.
Thus no primary key column of any row in a table can have a null value.
Referential integrity constraint refers to relationship between the tables. The relationship between tables is established by using foreign keys. This constraint states that a foreign key must have a matching primary key in another table or must be null.
For example, let’s say we have table SC that tells us which student study in which class. We also have Student and Class tables.
Thus every foreign key must contain a null value or a valid key reference in another table.
Download as PDF
Read next: Normalization ››
« Back to Course page
SBI Clerk Course 2023
ECGC PO Course 2023
SIDBI Grade A Course 2023
RBI Assistant Course 2023
SSC CHSL Course 2023
DSSSB JE Electrical 2023
Punjab Civil Services 2023
ESIC Deputy Director 2023