Bird
0
0

What is the main purpose of the UNIQUE constraint in SQL?

easy📝 Conceptual Q11 of 15
SQL - Table Constraints
What is the main purpose of the UNIQUE constraint in SQL?
ATo automatically generate unique IDs
BTo allow NULL values in a column
CTo speed up query performance
DTo prevent duplicate values in a column or group of columns
Step-by-Step Solution
Solution:
  1. Step 1: Understand the UNIQUE constraint and compare to options

    The UNIQUE constraint ensures that all values in a column or a set of columns are different from each other. The other options describe different SQL features, but only "To prevent duplicate values in a column or group of columns" correctly describes the UNIQUE constraint.
  2. Final Answer:

    To prevent duplicate values in a column or group of columns -> Option D
  3. Quick Check:

    UNIQUE constraint = prevent duplicates [OK]
Quick Trick: UNIQUE means no two rows can have same value [OK]
Common Mistakes:
MISTAKES
  • Confusing UNIQUE with PRIMARY KEY
  • Thinking UNIQUE speeds up queries
  • Assuming UNIQUE allows duplicates

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes