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. Unique key is always a foreign key
C. There is no difference
D. Primary key is always integer; unique key can be any data type
Answer: Option A
Solution (By JKSSB Mock Tests)
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
What is an attribute called when it can hold more than one value for a single entity instance, such as multiple phone numbers for a person?
A. Derived Attribute
B. Complex Attribute
C. Multi-valued Attribute
D. Composite Attribute

Correct Answer: Option C


Explanation:
A Multi-valued Attribute is an attribute that can store multiple distinct values for a single entity instance (e.g., skill_set, phone_numbers).

This question belongs to: Computer Database Management System (DBMS)
Question #2
What type of entity cannot be uniquely identified by its own attributes alone and must rely on a relationship with a parent entity?
A. Abstract Entity
B. Strong Entity
C. Associative Entity
D. Weak Entity

Correct Answer: Option D


Explanation:
A Weak Entity is an entity that does not possess its own primary key and depends on an identifying relationship with a strong (owner) entity.

This question belongs to: Computer Database Management System (DBMS)
Question #3
What is a data dictionary in a DBMS?
A. A log file
B. A table containing user data
C. A repository of metadata about the database
D. A backup of the database

Correct Answer: Option C


Explanation:
The data dictionary stores metadata such as table definitions, column types, constraints, and other database objects.

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