Skip to content
Official PYQ · 2021

GATE CS 2021 Set 2 Q6 — Integrity Constraints

Explain with AI

Consider the following statements S1S1 and S2S2 about the relational data model:

  • S1S1: A relation scheme can have at most one foreign key.
  • S2S2: A foreign key in a relation scheme RR cannot be used to refer to tuples of R.R.

Which one of the following choices is correct?

Choose one option
View worked solution

Answer: D

To determine the correctness of the statements, let us analyze them individually:

  • Statement S1S1: "A relation scheme can have at most one foreign key."
    Analysis: This statement is false. A relation can have multiple foreign keys referencing different relations (or even the same relation).
    Example: Consider an Enrollment relation:
    Enrollment(student_id‾,course_id‾,grade)\text{Enrollment}(\underline{\text{student\_id}}, \underline{\text{course\_id}}, \text{grade})
    Here, student_id\text{student\_id} is a foreign key referencing the Student\text{Student} relation, and course_id\text{course\_id} is another foreign key referencing the Course\text{Course} relation.

  • Statement S2S2: "A foreign key in a relation scheme RR cannot be used to refer to tuples of RR."
    Analysis: This statement is false. A relation can contain a self-referencing (recursive) foreign key that references its own primary key.
    Example: Consider an Employee relation:
    Employee(emp_id‾,name,manager_id)\text{Employee}(\underline{\text{emp\_id}}, \text{name}, \text{manager\_id})
    Here, manager_id\text{manager\_id} is a foreign key that references emp_id\text{emp\_id} within the same Employee\text{Employee} relation, representing the hierarchical relationship where a manager is also an employee.

Since both statements S1S1 and S2S2 are false, the correct choice is D.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Integrity Constraints questions