What is the difference between a primary key and a unique key? MCQ with Answer and Explanation

What is the difference between a primary key and a unique key?
A. Primary key cannot have NULL; unique key can have one NULL (in most DBMS)
B. Primary key is always integer; unique key can be any data type
C. Unique key is always a foreign key
D. There is no difference
Answer: Option A
Solution (By JKExamLibrary)
A primary key is a unique identifier that cannot be NULL, while a unique key allows NULL values (usually one) and can be used for alternate keys.

Discuss this Question (0)

No comments yet. Be the first to start the discussion!

Practice More Database Management System (DBMS) Questions

Question #1
When the same data is updated in one location but remains unchanged in another location, it creates a state of what?
A. Data Integrity
B. Data Inconsistency
C. Data Security
D. Data Independence

Correct Answer: Option B


Explanation:
Data Inconsistency occurs when different versions of the same data appear in different places due to uncontrolled data redundancy.

This question belongs to: Computer Database Management System (DBMS)
Question #2
Which operator is used to combine the distinct result sets of two or more SELECT queries into a single output, automatically filtering out duplicate rows?
A. UNION
B. UNION ALL
C. EXCEPT
D. INTERSECT

Correct Answer: Option A


Explanation:
The UNION operator merges the result sets of two queries, removing any duplicate records. UNION ALL performs a similar merge but retains duplicates.

This question belongs to: Computer Database Management System (DBMS)
Question #3
What does DDL stand for in SQL?
A. Dynamic Data Link
B. Data Manipulation Language
C. Data Definition Language
D. Data Description Language

Correct Answer: Option C


Explanation:
DDL (Data Definition Language) includes commands like CREATE, ALTER, DROP for defining database structures.

This question belongs to: Computer Database Management System (DBMS)