Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



The following table has two attributes Employee_id and Manager_id, where Employee_id is a primary key and Manager_id is a foreign key referencing Employee_id with on-delete cascade:

Employee_id Manager_id
20 40
25 40
30 35
35 20
40 45
45 25

On deleting the tuple $(20,40)$, the set of other tuples that must be deleted to maintain the referential integrity of the table is:





Solution

Deleting tuple $(20,40)$ means employee id $20$ is deleted.

Since $Manager_id$ is a foreign key referencing $Employee_id$ with on-delete cascade, all tuples having $Manager_id=20$ must also be deleted.

So, tuple $(35,20)$ must be deleted.

Now, deleting employee id $35$ will again affect tuples having $Manager_id=35$.

So, tuple $(30,35)$ must also be deleted.

No tuple has $Manager_id=30$, so the cascade stops here.

Therefore, the other tuples that must be deleted are

$(35,20)$ and $(30,35)$



Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...