| Constraint type | Syntax |
| Primary key | CONSTRAINT name PRIMARY KEY |
| Unique index | CONSTRAINT name UNIQUE |
| Foreign key | CONSTRAINT name REFERENCES foreigntable [(foreignfield1[, foreignfield2, [...]]] |
| Constraint type | Syntax |
| Primary key | PRIMARY KEY (field1[, field2[, ...]]) |
| Unique index | UNIQUE (field1[, field2[, ...]]) |
| Foreign key | FOREIGN KEY (field1[, field2[, ...]]) REFERENCES foreigntable [(foreignfield1[, foreignfield2[, ...]])] |
The parts of the CONSTRAINT clause have the following meanings:
| Part | Meaning |
| name | The name of the constraint to be created |
| fieldn | The name of the field constrained by the constraint |
| foreigntable | The name of the table containing the referenced fields |
| foreignfieldn | The referenced fields in the referenced table.
Note: You must list the referenced fields in the same order as the corresponding referencing fields. |