1CREATE TABLE employee
2
3 ( employee_id VARCHAR(20),
4
5 Name VARCHAR (20),
6
7 Address VARCHAR (20),
8
9 Mobile_no SMALLINT);
10
1Adds a constraint that limits the value which can be added to a column.
2Example 1 (MySQL): Makes sure any users added to the users table are 18
3or over.
4CREATE TABLE users (
5first_name varchar(255),
6age int,
7CHECK (age>=18)
8);
9Example 2 (MySQL): Adds a check after the table has already been
10created.
11ALTER TABLE users
12ADD CHECK (age>=18);