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?

  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 168 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: Niacl Ao It Specialist