Database Reference
In-Depth Information
Figure 20.1
CREATE TABLE
with Constraints
Syntax.
TABLE, and ALTER VIEW commands. CREATE TABLE and CREATE
VIEW commands obviously only allow constraint creation. The ALTER
TABLE and ALTER VIEW commands allow creation of constraints on
existing tables and views, plus modification of existing constraints. Let's
examine the syntax of each command in detail. This chapter is intended to
focus on constraints only and thus syntax for the aforementioned com-
mands is in addition to that in Chapters 18 and 19.
20.2.1
CREATE TABLE Syntax
Let's begin with inline and out-of-line constraints. As you can see clearly in
Figure 20.1, an inline constraint is attached to a column, whereas an out-
of-line constraint can be pictured as being a column in itself.
Getting a little more complicated, Figure 20.2 shows the details of CRE-
ATE TABLE syntax for inline constraints, out-of-line constraints, and con-
straint states.
Note:
Constraint states are covered in detail later in this chapter under the
section on the ALTER TABLE command.
Let's look at some examples. Constraints can be added to tables when
tables are created using the CREATE TABLE statement. Let's experiment
with different types of constraints.
Search WWH ::




Custom Search