Primary key fundamentals: In a properly designed relation, a primary key is best described as which of the following?

Difficulty: Easy

Correct Answer: An attribute that uniquely identifies each row

Explanation:


Introduction / Context:
The primary key (PK) is the cornerstone of relational design. It guarantees that each tuple (row) is unique and provides a stable target for foreign key references from other tables, enabling consistent joins and integrity.



Given Data / Assumptions:

  • Each relation represents one entity type or a well-defined conceptual grouping.
  • The PK may be a single attribute or a composite of multiple attributes.
  • PK attributes are non-null and unique.


Concept / Approach:

A primary key is a minimal set of attributes whose combined values uniquely identify each row. The database enforces uniqueness and non-nullability, providing a reliable mechanism to locate and associate records across the schema.



Step-by-Step Solution:

Choose candidate keys (attributes that can uniquely identify rows).Select one candidate to serve as the primary key based on stability and simplicity.Apply NOT NULL and UNIQUE semantics; create indexes as needed.


Verification / Alternative check:

Check that count(rows) equals count(DISTINCT PK) and that no PK value is NULL. This confirms correctness of the chosen PK.



Why Other Options Are Wrong:

Any attribute: not necessarily unique.

Uniquely identifies each column: columns are identified by names, not runtime values.

Derived attribute: derivation does not imply uniqueness or suitability as PK.



Common Pitfalls:

Choosing volatile attributes (like email) as PKs; better to use stable natural keys or surrogate keys.



Final Answer:

An attribute that uniquely identifies each row

More Questions from Logical Database Design

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion