This is two-part question involving CHECK statements, In my first CHECK for some reason it works but actually allows null to be inserted into the field... any ideas how to remedy this? In my second CHECK, It plain and simple does not work. It's allowing anything to be inserted.
ALTER TABLE table_name ADD (CONSTRAINT CK_CON (name IN ('Jon','Bill','Ted','Ron','Jeff')));
ALTER TABLE table_name ADD (CONSTRAINT CK_NAME CHECK(
(name='John') OR (name='Mary') OR
(name='Jane') OR (name= 'Bruce') OR (name= '')));
WHEREclause, the entire predicate has to beTRUEin order to match. In aCHECKconstraint, the predicate needs to not beFALSE. Where this makes a difference is precisely in the areas ofNULLs and the fact that SQL has a three-valued logic which sometimes producesUNKNOWNwhenNULLcrops up.