Introduction
A CHECK constraint helps make sure the data in a table follows simple rules. It stops wrong or unexpected data from being saved.
When you want to make sure a person's age is always 0 or more.
When you want to ensure a product's price is never negative.
When you want to allow only certain values in a column, like 'Male' or 'Female' for gender.
When you want to keep dates in a valid range, like a start date before an end date.
When you want to prevent invalid status values in an order, like only 'Pending', 'Shipped', or 'Cancelled'.