UNIQUE Constraint


The UNIQUE constraint ensures that all values in a column are different.

It prevents duplicate entries.

Each value must be unique.

UNIQUE is commonly used for email, username, or mobile number.

Duplicate values are not allowed.

This improves data accuracy.

UNIQUE can be applied to one or multiple columns.

It ensures no repeated data exists.

This helps maintain clean records.

If a duplicate value is inserted, the database will reject the operation.

This protects data integrity.

UNIQUE constraint avoids duplication problems.

It is essential in real-world applications.

UNIQUE is frequently asked in SQL interviews.