ITPEC FE Morning April 2023 Question 27

Source exam: ITPEC FE Morning April 2023Topic: Databases

ITPEC FE Morning April 2023 — Question 27 of 80

Primary Key vs Foreign Key — constraints in a relational database.

  • Primary key (PK): values must be unique and NOT NULL; identifies each row
  • Foreign key (FK): references the primary key of a related table; values can be duplicated (one-to-many) and can be NULL (optional relationship)

Why not others:
- (a) — PK can be composite, but does not have to contain a FK column

- (b) — FK values can be duplicated and can be NULL

- (d) — reversed logic: FK must reference the related table's PK, not the other way around

Key rule: PK = unique + not null; FK = must match an existing PK value (or be NULL), duplicates allowed.

AI-generated — may contain errors

The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.