Referential Integrity constraints and Foreign Keys
In this class, we will understand Referential Integrity constraints and Foreign Keys.
We have already discussed the concepts of domain constraints, key constraints, and NULL constraints.
Referential Integrity constraints and Foreign Keys
So far, all the constraints are on a single table, but the referential integrity is made on two tables.
What is a referential integrity constraint?
A Referential Integrity Constraint is specified between two relations and is used to maintain the consistency among the tuples in the two relations.
To understand this, we will consider the two relations with a referential integrity constraint, as shown below.
the arrow mark represents that the values of the Dno of the employee table are referencing the values in the department table.
For better understanding, we will insert a new employee table as shown below.
Is the new row insertion consistent?
No, the Dno 2 does not exist, but we are trying to insert an employee working for department 2.
By establishing a relation, we can maintain consistency and integrity among the tables of the database.
The referential integrity constraint is established by using a foreign key keyword.
In the next class, we will implement a referential integrity constraint.
#learningmonkey #dbms #placements #gatecse #gatedbms #campusplacements
Link for playlists:
[ Ссылка ]
Link for our website: [ Ссылка ]
Follow us on Facebook @ [ Ссылка ]
Follow us on Instagram @ [ Ссылка ]
Follow us on Twitter @ [ Ссылка ]
Mail us @ learningmonkey01@gmail.com
Ещё видео!