A database designer wants to ensure that no two customers can have the some Aadhaar Number in a table. Identify the SQL constraint suitable for this requirement.
AUNIQUE
BNOT NULL
CCHECK
DDEFAULT
Answer:
A. UNIQUE
Read Explanation:
SQL Constraint for Uniqueness
The UNIQUE constraint is specifically designed to ensure that all values in a column are different, preventing duplicate entries across rows.
When applied to an Aadhaar Number field, it ensures data integrity by enforcing that no two records share the same identifier, which is critical for identity verification systems.
Key Characteristics of UNIQUE:
It allows NULL values (unless a NOT NULL constraint is also explicitly applied).
A table can have multiple UNIQUE constraints defined on different columns.
It automatically creates a unique index on the specified column to optimize query performance during data retrieval and validation.
Comparison with PRIMARY KEY:
A PRIMARY KEY constraint also enforces uniqueness but automatically implies NOT NULL and allows only one such key per table.
While a PRIMARY KEY is used to uniquely identify a row, the UNIQUE constraint is preferred for columns like Aadhaar Number, PAN, or Email that are unique but not necessarily the primary identifier of the record.