I have a table with following scehma
CREATE TABLE MyTable
(
ID INTEGER DEFAULT(1,1),
FirstIdentifier INTEGER NULL,
SecondIdentifier INTEGER NULL,
--.... some other fields .....
)
Now when inserting a value, one of the column between FirstIdentifier and SecondIdentifier should be
NOT NULL. Is there anyway of enforcing it via schema?
This is possible with using a
CHECKconstraint:While CHECK constraints are part of the table (and hence “schema”?), they may not fit the desired definition. The above CHECK is not mutually exclusive, but it could be altered to such.
Happy coding.