• Got it wrong because the question specified unique constraint instead of unique index.

    And even then, the unique index in the sample code doesn't allow NULLs. The index is defined on the part of the table where there aren't any NULLs. This would be the same as saying:

    "There a night club in the city. The night club doesn't allow people under 21 to enter. Ergo, the whole city doesn't allow people under 21 to enter."

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP