Computer Science

What constraint should be applied on a table column so that duplicate values are not allowed in that column, but NULL is allowed.

SQL Queries

4 Likes

Answer

To prevent duplicate values in a table column while allowing NULL values, we should use the UNIQUE constraint. The UNIQUE constraint ensures that all values in the specified column are different, but it permits multiple NULLs since NULL is considered distinct from any other value.

Answered By

3 Likes


Related Questions