Looks like your condition is actually a logical implication: if a is null
then b is null
. From our symbolic logic course (PHIL 140 in my case), we know that:
(P -> Q) <-> (-P | Q)
where ->
is implication and <->
is logical equivalence.
Applying that to our implication and SQLizing it yields:
a is not null or b is null
so a simple check(a is not null or b is null)
constraint is sufficient.