Data Definition Language
Overview
The SQL DDL consists of syntactic constructs for creating and modifying schemas. These include:
CREATE TABLE. Adds a new relation to the database.ALTER TABLE. Modifies an existing relation in the database.DROP TABLE. Removes a relation from the database.
Integrity Constraints
An integrity constraint is any restriction enforced by the database on the values stored within the database. In particular, SQL prevents any updates that violate an integrity constraint.
- Foreign key. Specifies a set of attributes within a table must correspond to the primary key of some tuple in a table.
- Primary key. Specifies a set of attributes within a table must be both nonnull and unique.
- Not null. Specifies an attribute excludes the
NULLvalue from the attribute's domain.