Referential integrity is directly related to

2012

Referential integrity is directly related to

Answer: B. Foreign keyConceptIntegrity constraints in the relational model are classified by the scope over which they act. Entity integrity acts inside a single relation: the…

  1. A.

    Relation key

  2. B.

    Foreign key

  3. C.

    Primary key

  4. D.

    Candidate key

Attempted by 323 students.

Show answer & explanation

Correct answer: B

Concept

Integrity constraints in the relational model are classified by the scope over which they act. Entity integrity acts inside a single relation: the attribute set chosen to identify its tuples must not repeat across tuples and must never be null. Referential integrity acts across two relations: whenever one relation carries an attribute set whose values are drawn from an identifying attribute set of another relation, every non-null value appearing in that attribute set must already exist in the other relation.

The relational model gives that borrowed, cross-relation attribute set a name of its own — a foreign key — and declaring it on the referencing relation is exactly how the referential-integrity constraint is stated.

Application

The stem asks which construct referential integrity is directly related to. The constraint cannot even be written down without two things: the attribute set that does the referencing, and the relation it points at. The attribute set that does the referencing is the foreign key, so referential integrity is directly related to Foreign key.

Concretely, let ENROLMENT(student_id, course_id) carry student_id referencing STUDENT(student_id). The foreign key student_id is what the DBMS checks on every write: a row of ENROLMENT with student_id = 57 is accepted only when STUDENT already holds a tuple with student_id = 57, and deleting that STUDENT tuple is either rejected or cascaded so no ENROLMENT row is left pointing at a value that no longer exists.

Cross-check and contrast

Construct

What it is, and how it stands relative to the constraint

Primary key

The attribute set chosen to identify the tuples of one relation; it enforces entity integrity — no repeated value, no null — inside that relation. A reference may point at it, but it may equally point at any other declared unique key of that relation, and the referential-integrity constraint itself is declared on the referencing side.

Candidate key

A minimal attribute set that identifies the tuples of one relation; dropping any attribute from it leaves it unable to identify the tuples. A relation may admit several, and one of them is promoted to the identifying role.

Relation key

The general term covering the identifying attribute sets a single relation defines over its own attributes. It names a family of within-relation identifiers and carries no cross-relation obligation.

Result

Referential integrity is stated by, and enforced on, the foreign key.

Explore the full course: Tpsc Assistant Technical Officer

Loading lesson…