Difference between revisions of "SQL Constraints"

From Lianjapedia
Jump to: navigation, search
m (1 revision: SQL)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
To define rules that help to provide data integrity
 
To define rules that help to provide data integrity
 
  
 
==See Also==
 
==See Also==
 
[[ALTER TABLE]], [[CREATE TABLE]], [[GRANT]], [[REVOKE]]
 
[[ALTER TABLE]], [[CREATE TABLE]], [[GRANT]], [[REVOKE]]
 
  
 
==Description==
 
==Description==
Line 11: Line 9:
  
 
====Table Constraints====
 
====Table Constraints====
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 25: Line 22:
 
|-
 
|-
 
|}
 
|}
 
  
 
====Column Constraints====
 
====Column Constraints====
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 45: Line 40:
 
|}
 
|}
  
 
==Products==
 
Recital, Recital Server
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:SQL|Constraints]]
 
[[Category:SQL|Constraints]]
 
[[Category:Reference]]
 
[[Category:Reference]]

Revision as of 11:11, 15 November 2012

Purpose

To define rules that help to provide data integrity

See Also

ALTER TABLE, CREATE TABLE, GRANT, REVOKE

Description

A constraint is used to define rules that help to provide data integrity. There are two different types of constraints, TABLE constraints, which do not require any column information and column constraints, which are specific to the column name specified. You must have ALTER privilege on the table. The table will be locked for EXCLUSIVE use during the operation.

Table Constraints

CHECK ERROR FOREIGN KEY
INDEX KEY ONCLOSE
ONDELETE ONINSERT ONOPEN
ONROLLBACK ONUPDATE PRIMARY KEY
UNIQUE

Column Constraints

AUTO_INCREMENT AUTOINC CALCULATED
CHECK DEFAULT DESCRIPTION
ERROR FOREIGN KEY NOCPTRANS
NOT NULL NULL PRIMARY KEY
RANGE RECALCULATE REFERENCES
SET CHECK UNIQUE