Data Integrity Enforcement in RDBMS

Key Constraint

Referential Integrity(RI)

Screen Shot 2021-10-27 at 10.58.47 AM.png

SQL Referential Integrity Syntax

CREATE TABLE Enroll(
   sid INT,
	 dept CHAR(2),
	 cnum INT,
	 sec INT
	 FOREIGN KEY(sid) REFERENCES Student(sid),
	 FOREIGN KEY(dept, cnum, sec) REFERENCES Class(dept,cnum,sec)
)
# or since sid is just one attribute, we can do
sid INT REFERENCES Student(sid)

Screen Shot 2021-10-27 at 10.32.41 AM.png

Insert into E, Update E, Delete from S, Update S

More comments on Referential Intergrity