What is a key risk when deleting rows referenced by foreign keys in SQL?

2025

What is a key risk when deleting rows referenced by foreign keys in SQL?

Answer: D. Orphaned child records if ON DELETE CASCADE isn't usedWhen you delete a row from a parent table that is actively referenced by a foreign key in a child table, you risk breaking referential integrity. If the…

  1. A.

    Automatic table encryption

  2. B.

    Duplicate primary keys

  3. C.

    Improved query performance

  4. D.

    Orphaned child records if ON DELETE CASCADE isn't used

Attempted by 435 students.

Show answer & explanation

Correct answer: D

When you delete a row from a parent table that is actively referenced by a foreign key in a child table, you risk breaking referential integrity.

If the database schema does not explicitly block the deletion (e.g., via a RESTRICT or NO ACTION constraint) or automatically clean up the child table using a referential action like ON DELETE CASCADE, the rows in the child table will lose their valid parent association. These left-behind rows are known as orphaned child records, meaning they contain a foreign key value pointing to a parent record that no longer exists.

Explore the full course: Rssb Basic Computer Instructor

Loading lesson…