Difference between revisions of "SQL Constraints"
From Recital Documentation Wiki
Helengeorge (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
(One intermediate revision by one user not shown) | |||
Line 13: | Line 13: | ||
− | {| class="wikitable" | + | {| class="wikitable" width="100%" |
|[[CHECK Table Constraint|CHECK]]||[[ERROR Table Constraint|ERROR]]||[[FOREIGN KEY Table Constraint|FOREIGN KEY]] | |[[CHECK Table Constraint|CHECK]]||[[ERROR Table Constraint|ERROR]]||[[FOREIGN KEY Table Constraint|FOREIGN KEY]] | ||
|- | |- | ||
Line 30: | Line 30: | ||
− | {| class="wikitable" | + | {| class="wikitable" width="100%" |
|[[AUTO_INCREMENT Column Constraint|AUTO_INCREMENT]]||[[AUTOINC Column Constraint|AUTOINC]]||[[CALCULATED Column Constraint|CALCULATED]] | |[[AUTO_INCREMENT Column Constraint|AUTO_INCREMENT]]||[[AUTOINC Column Constraint|AUTOINC]]||[[CALCULATED Column Constraint|CALCULATED]] | ||
|- | |- | ||
Line 46: | Line 46: | ||
− | + | ||
− | + | ||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:SQL|Constraints]] | [[Category:SQL|Constraints]] | ||
[[Category:Reference]] | [[Category:Reference]] |
Latest revision as of 10:22, 6 March 2015
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 |