Computer >> Computer tutorials >  >> Programming >> SQL

Referential Integrity Rule in RDBMS


Referential Integrity Rule in DBMS is based on Primary and Foreign Key. The Rule defines that a foreign key have a matching primary key. Reference from a table to another table should be valid.

Referential Integrity Rule example

<Employee>

EMP_ID
EMP_NAME
DEPT_ID


<Department>

DEPT_ID
DEPT_NAME
DEPT_ZONE


The rule states that the DEPT_ID in the Employee table has a matching valid DEPT_ID in the Department table.

To allow join, the referential integrity rule states that the Primary Key and Foreign Key have same data types.

Referential Integrity Rule in RDBMS