I have this question around SQL constraints, in order to achieve following behavior:
TableA has two columns column0 and column1, which only one can be NULL on data entry: e.g.: if column0 is null, column1 can't be null if column1 is null, column0 can't be null
To achieve this, I've build following SQL constraints:
CONSTRAINT column01_not_null_chk
CHECK (
( column0 IS NOT NULL
AND column1 IS NULL )
OR
( column1 IS NOT NULL
AND column0 IS NULL ) )
is this correct to achieve my behavior? Because all SQL are rejected because of this constraint
mysql,postgresql,sql-server,oracleordb2- or something else entirely.