Key Constraints and Nullability: Which One Cannot Be NULL?

Key Constraints and Nullability: Which One Cannot Be NULL?

Verified Sources
Nov 4, 2026

In relational database theory and SQL, the phrase “cannot be null” is tied most directly to the primary key. A primary key is defined (and enforced in SQL) to be both unique and NOT NULL. This is why, among the options—(i) Unique key, (ii) Primary key, (iii) Super key, (iv) Foreign key—the key that cannot be NULL is:

✅ (ii) Primary key

To frame the reasoning, it helps to distinguish theoretical keys (like super key), and constraint-enforced keys (like foreign key and unique key).

Important nuance (SQL): unique key constraints often allow multiple NULLs (DBMS-dependent), so “cannot be NULL” is not generally true for Unique key across SQL semantics. Similarly, a foreign key can be NULL if the relationship is optional.

Primary Key vs Unique Key vs Foreign Key (SQL) — Quick Concept Overview

Key definitions (theory vs SQL enforcement)

  • Primary key: guarantees uniqueness and no NULLs.
  • Unique key: guarantees uniqueness, but NULL handling may allow multiple NULLs depending on SQL/DBMS.
  • Super key: any superset of a key; theoretical “super key” concept does not automatically impose NOT NULL.
  • Foreign key: enforces referential integrity; a NULL foreign key typically means “no referenced row.”

How NULL Constraints Relate to Different Key Types

Super key

1. Identify the candidate identifier

A super key uniquely identifies rows (theoretically). It does not by itself require NOT NULL."

Primary key

2. Choose the minimal identifier

Primary key is minimal and enforced as unique AND NOT NULL."

Unique key

3. Enforce uniqueness without being the row identifier

Unique key enforces uniqueness, but NULL handling may permit multiple NULLs."

Foreign key

4. Link tables

Foreign key enforces references to another table; it can be NULL when the relationship is optional."

Answering the MCQ: Which key cannot be NULL?

  1. 1
    Step 1

    A primary key must be unique and has no NULL values.

  2. 2
    Step 2

    A unique key is about uniqueness; NULL behavior is not inherently “forbidden.”

  3. 3
    Step 3

    A super key is a theoretical set of attributes; NOT NULL is not part of the definition.

  4. 4
    Step 4

    A foreign key may be NULL to represent “no relationship,” while still enforcing referential integrity for non-NULL values.

  5. 5
    Step 5

    Therefore the correct choice is (ii) Primary key.

Pro Tip

In SQL interviews/exams, “cannot be NULL” almost always refers to the PRIMARY KEY (unless the question explicitly changes the DB model).

Common misconception

Some learners assume “unique” implies “no NULLs.” In many SQL systems, multiple NULLs can appear in a UNIQUE constraint; the strict “no NULL” rule belongs to PRIMARY KEY.

Null Prohibition vs Key Type (Typical SQL Interpretation)

Heuristic view for the MCQ: which key type is defined to disallow NULL?

FAQs and Edge Cases

Knowledge Check

Question 1 of 4
Q1Single choice

Which key cannot be null?