Primary Key

Constraints and Triggers

In this section we shall study those aspects of SQL that let us create "active" elements. An active element is an expression or statement that we write once, store in the database, and expect the element to execute at appropriate times. The time of action might be when a certain

Keys Declared With UNIQUE

One more way to declare a key is to use the keyword UNIQUE. This word can appear exactly where PRIMARY KEY can appear: either following an attribute and its type or as a separate item within a CREATE TABLE statement. The meaning of a UNIQUE declaration is nearly the

Declaring Foreign-Key Constraints

A second important kind of constraint on a database schema is that values for certain attributes must make sense. That is, an attribute like presC# of relation Studio is expected to refer to a particular movie executive. The implied "referential integrity" constraint is that if a studio's

Tuple-Based CHECK Constraints

To declare a constraint on the tuples of a single table R, when we define that table with a CREATE TABLE statement we may add to the list of attributes and key or foreign-key declarations the keyword CHECK followed by a parenthesized condition. This condition can be anything that

Modification of Constraints

It is possible to add, modify, or delete constraints at any time. The way to express such modifications depends on whether the constraint involved is associated with an attribute, a table, or a database schema.

Page 0 of 1 Previous 1 Next