How does a properly implemented foreign key constraint contribute to the…

2025

How does a properly implemented foreign key constraint contribute to the consistency property in a database transaction?

  1. A.

    By ensuring that all inserted rows are committed immediately

  2. B.

    By ensuring that a referenced record exists in the parent table

  3. C.

    By automatically removing orphan records during insertion

  4. D.

    By allowing duplicate values in the referencing column

Attempted by 202 students.

Show answer & explanation

Correct answer: B

A foreign key enforces referential integrity, which directly supports the Consistency (C) property of ACID transactions. It guarantees that a child table cannot reference a non-existent value in the parent table. If a transaction attempts to insert an invalid reference or delete a parent record that still has active child records, the database engine automatically rejects the transaction, preventing data corruption and keeping the system in a valid state.

Explore the full course: Niacl Ao It Specialist