Learn VisualLearn DB

Check Presence and Range Separately

NOT NULL requires a value to be present. CHECK requires its condition to be true or unknown, so CHECK (price >= 0) rejects negative values but still permits NULL. A required nonnegative price therefore needs both NOT NULL and CHECK.

GOAL

Combine NOT NULL and CHECK to express independent requirements.

What does CHECK (qty > 0) do when qty is NULL?