Database - Check Constraint


The CHECK constraint is used to limit the value range that can be placed in a column.
If you define a CHECK constraint on a single column it allows only certain values for
this column.
If you define a CHECK constraint on a table it can limit the values
in certain columns based on values in other columns in the row.

 create table emp_det3(empno int constraint pk_empdet3 primary key,
ename varchar(20),city varchar(20),
state char(2) constraint ck_sta1 check(state in('TN','AP','KL')))
select *from emp_det3

Comments

Popular posts from this blog

How to set Java Object into JaxBElement ?

GitLab