Differences

This shows you the differences between two versions of the page.

Link to this comparison view

conditional_check_constraint [2019/01/30 16:39]
conditional_check_constraint [2021/04/05 11:23] (current)
Line 1: Line 1:
 +====== Conditional Check Constraint ======
  
 +<sxh sql>
 +ALTER TABLE table1 ADD CONSTRAINT table1_conditional
 +CHECK(
 +  (field1 = 1 AND field3 IN ('MIHAEL', 'MICHAEL')) OR
 +  (field1 = 2 AND field3 IN ('MIHAIL', 'MIKAEL'))
 +);
 +</sxh>
 +
 +{{tag>sql}}