Which of the following key constraints is required for functioning of foreign…

2019

Which of the following key constraints is required for functioning of foreign key in the context relational databases?

  1. A.

    Unique key

  2. B.

    Primary key

  3. C.

    Candidate key

  4. D.

    Check key

Attempted by 1516 students.

Show answer & explanation

Correct answer: B

Answer: Primary key

Explanation: A primary key uniquely identifies each row in the referenced table and provides the required identity that foreign keys point to. By referencing a primary key, a foreign key enforces referential integrity: every foreign key value must match an existing primary key value.

  • Primary key: A chosen candidate key that guarantees uniqueness and (typically) NOT NULL, and is the usual target for foreign key references.

  • Foreign key: A column in one table whose values must match values of the referenced primary key in another table, ensuring referential integrity.

  • Candidate key and unique key: A candidate key is any column(s) that can uniquely identify rows; one candidate is designated as the primary key. A unique constraint also ensures uniqueness, and some DBMS allow foreign keys to reference a unique column, but the conventional and standard reference target is the primary key.

  • CHECK constraint: CHECK enforces a condition on column values and does not provide uniqueness or identity; it is unrelated to establishing foreign key relationships.

Key takeaway: Primary key is the required and standard target for foreign keys because it uniquely identifies rows and enforces referential integrity. Note the practical nuance that some systems allow referencing a unique key as well.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor