Define referential integrity.
Referential integrity in Oracle is used to establish relationships between tables through foreign keys. When one table’s primary key is taken as a “reference” in another table, it is called as a foreign key. This ensures that no record may be added containing the foreign key until a record in the corresponding table exists.
Example:Below is an example of how a relationship between manager and employee is established in which manager’s id is taken as a foreign key in employees table.
ALTER TABLE employee
ADD
CONSTRAINT ( emp_id_fk )
FOREIGN KEY
( manager_id )
REFERENCES employee (manager_id);
Define referential integrity.
Referential integrity is the rules that governs the relationships between primary keys and foreign keys of the tables and ensure data consistency. It ensures the value of foreign key be matched by the value of a primary key in another table.