CHECK Constraint
The CHECK
constraint ensures that the values in a column satisfy a specific condition.
Example: Using CHECK Constraint
CREATE TABLE Contributions (
ContributionID INT PRIMARY KEY,
Amount DECIMAL(10, 2) CHECK (Amount > 0),
ContributionDate DATE
);
Explanation: The Amount
column must have a value greater than 0, ensuring no negative contributions.