Databases · Junior · Question 6 of 75

What is the difference between UNIQUE and PRIMARY KEY?

Explanation

By default PostgreSQL treats NULLs as distinct, so a UNIQUE column can contain several NULLs. UNIQUE NULLS NOT DISTINCT changes that.

Further reading

Problem with a question

Databases · Junior · question 6

Test yourself

Take the Databases · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz