I am curious to know is it possible to create a conditional not null constraint in sql? In otherwords is it possible to create a constraint such that a column B can be null
I think your first stated requirement is:
IF ( B IS NULL ) THEN ( A = 'NEW' )
Apply the implication rewrite rule:
IF ( X ) THEN ( Y ) <=> ( NOT ( X ) OR ( Y ) )
In your case;
( NOT ( B IS NULL ) OR ( A = 'NEW' ) )
Minor rewrite to take advantage of SQL syntax:
( B IS NOT NULL OR A = 'NEW' )
Your second stated ("extend") requirement:
IF ( A = 'NEW' ) THEN ( B IS NULL )
Apply rewrite rule:
( NOT ( A = 'NEW' ) OR ( B IS NULL ) )
Minor rewrite:
( A <> 'NEW' OR B IS NULL )