Unique Index that Allows NULLS
suggest changeCREATE UNIQUE INDEX idx_license_id
ON Person(DrivingLicenseID) WHERE DrivingLicenseID IS NOT NULL
GO
This schema allows for a 0..1 relationship - people can have zero or one driving licenses and each license can only belong to one person
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents