Tables, Keys & Constraints · Question 5 · Easy

How many PRIMARY KEY constraints can one table have?

  1. One for every NOT NULL column
  2. Any number, as long as each is on a different column
  3. At most two: one main key and one alternate key
  4. Exactly one, though it may be made of several columns
Answer and explanation

Answer: D. Exactly one, though it may be made of several columns

Explanation: A table has at most one primary key. That key can be composite, such as PRIMARY KEY (roll, course), but it is still a single constraint. Extra unique identifiers are declared with UNIQUE.

Previous: What happens when the INSERT runs? · Next: Which statement can remove only those rows of a table that satisfy a…

Practise tables, keys & constraints

Try a fresh set of tables, keys & constraints questions with an explanation after every answer, free and without signing up: Tables, Keys & Constraints practice. Or sit a full placement mock test.

More tables, keys & constraints questions

More sql practice

DML & Transactions · SELECT, WHERE & ORDER BY · SQL Joins · Aggregates & GROUP BY · Subqueries & CTEs · Window Functions · NULL Handling · SQL Functions & CASE

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge