To clarify – there will be up to 4 distinct players in the table, referenced by their ids. I want to enforce this, i.e. no two ids are the same.
Also, because it’s up to 4 players, some may be null. Is potentially having many nulls like this a bad idea? I don’t think it does, but just to be sure, does null == null return false?
...
CHECK (playerid1 <> playerid2)
AND (playerid1 <> playerid3)
AND (playerid1 <> playerid4)
AND (playerid2 <> playerid3)
AND (playerid2 <> playerid4)
AND (playerid3 <> playerid4)
...
Thank you!
I’d use a separate table for this:
Then you can add
This should achieve what you want in a somewhat cleaner (IMHO) way.