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:
https://www.youtube.com/channel/UCl8x4Pn9Mnh_C1fue-Yndig/playlists
Link for our website: https://learningmonkey.in
Follow us on Facebook @ https://www.facebook.com/learningmonkey
Follow us on Instagram @ https://www.instagram.com/learningmonkey1/
Follow us on Twitter @ https://twitter.com/_learningmonkey
Mail us @ learningmonkey01@gmail.com
0 Comments