engineering computer science MCQ #616

What is the difference between a PRIMARY KEY and a UNIQUE constraint?

engineering computer science MCQ #616

  1. Question 1

    Q1. What is the difference between a PRIMARY KEY and a UNIQUE constraint?

    • A) A PRIMARY KEY allows NULL values
    • B) A UNIQUE constraint allows duplicate values
    • C) A PRIMARY KEY is used for indexing
    • D) A PRIMARY KEY cannot be NULL, while a UNIQUE constraint can have one NULL value

    Answer: A PRIMARY KEY cannot be NULL, while a UNIQUE constraint can have one NULL value

    Explanation: A PRIMARY KEY uniquely identifies each row and cannot be NULL, while a UNIQUE constraint ensures uniqueness but allows one NULL value.