SQL · Question 4 · Easy

Which constraint ensures that all non-NULL values in a column are distinct and, unlike PRIMARY KEY, allows the column to contain NULL?

  1. PRIMARY KEY
  2. UNIQUE
  3. CHECK
  4. FOREIGN KEY
Answer and explanation

Answer: B. UNIQUE

Explanation: UNIQUE enforces distinct values but allows NULLs. PRIMARY KEY is both unique and NOT NULL.

Previous: Which SQL command removes all rows from a table but keeps the table structure… · Next: Table Employee: id | name | dept | salary 1 | Asha | HR | 30000 2 | Ravi | IT…

Practise sql

Try a fresh set of sql questions with an explanation after every answer, free and without signing up: SQL practice. Or sit a full placement mock test.

More sql questions

More technical & programming practice

Operating Systems · Computer Networks · Software Engineering · Cloud & DevOps · GenAI Basics · Pseudo-code · C Programming · Java

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