Setting CHECK constraint for number type field
SQL>
SQL>
SQL> CREATE TABLE myTable (
2 Name VARCHAR(50) PRIMARY KEY NOT NULL,
3 PhoneNo VARCHAR(15) DEFAULT 'Unknown Phone',
4 Age INT,
5 CONSTRAINT CheckAge CHECK (Age BETWEEN 10 and 100)
6 );
Table created.
SQL>
SQL> drop table myTable;
Table dropped.
SQL>
SQL>
Related examples in the same category