SQL Keyword - CHECK

CHECK Keyword

The CHECK keyword or constraint is used to limit the value that can be inserted in a column.

SQL CHECK ON CREATE TABLE

CREATE TABLE <TABLE_NAME> (
    <COLUMN_NAME> DATATYPE CHECK (<CONDITION>)
);

Example

CREATE TABLE Employee (
    EMP_AGE Integer CHECK (EMP_AGE >= 18)
);

SQL CHECK ON ALTER TABLE

ALTER TABLE <TABLE_NAME>
ADD CHECK (<CONDITION>);

Example

ALTER TABLE Employee ADD CHECK (Emp_Age >= 18);

Summary

The CHECK keyword or constraint is used to limit the value that can be inserted in a column.

Next Recommended Reading Top Keyword in SQL