Please send your Questions & Answers or Feedback to "mohan@javabook.org"

What is a Check constraint ?

A Check constraint allows you to specify a condition on each row in a table.

A Check constraint can be defined in either a CREATE TABLE statement or an ALTER TABLE statement.

A check constraint can NOT be defined on a VIEW.

The check constraint defined on a table must refer to only columns in that table. It can not refer to columns in other tables.

A check constraint can NOT include a SUBQUERY.

 

Syntax:

 

CREATE TABLE table_name

(

  column1 datatype null/not null,

  column2 datatype null/not null,

  CONSTRAINT constraint_name CHECK (column_name condition) [DISABLE]

);

Related Posts Plugin for WordPress, Blogger...
Flag Counter