Skip to content

CHECK

CREATE TABLE Students (
ID INT,
Name VARCHAR(100),
Age INT,
CHECK (Age >= 5 AND Age <= 20)
);

Query OK, 0 rows affected, 1 warning (0.01 sec)

The SQL code snippet above creates a Students table with three columns: ID, Name, and Age. The CHECK constraint ensures that the Age entered during the data injection into this table is always between 5 and 20, inclusive.