I have 3 "Nullable" columns.
I am looking for a way to restrain it so that:
- One of the three has value, the other two columns must be null
- All three cannot be null
Is it possible to do this?
I tried this:
CREATE UNIQUE INDEX alpha ON contacts ("a")
WHERE "b" IS NULL AND "c" IS NULL;
CREATE UNIQUE INDEX beta ON contacts ("b")
WHERE "a" IS NULL AND "c" IS NULL;
CREATE UNIQUE INDEX gamma ON contacts ("c")
WHERE "a" IS NULL AND "b" IS NULL;