Database Reference
In-Depth Information
Figure 18.3
A CREATE
TABLE Pseudo-
like Syntax.
table is shown in Figure 18.4. Inline and out-of-line constraints are covered
in detail in Chapter 20.
We have already looked at the ARTIST table in this chapter. Let's look
at the data warehouse section SALES table. The SALES table has more col-
umns than the ARTIST table and many more different datatypes for its col-
umns. Once again, all primary and foreign keys are constraints and are
covered in Chapter 20. Additionally, NOT NULL is a constraint prohibit-
ing a column from being empty within a row. Other than those points, the
only thing to note is that DEFAULT clauses have been added to allow for
column values with nothing added to them. Various numeric columns will
be set to zero if a row is added to the SALES where those defaulted columns
are not specified. In these cases, null values will be replaced with default val-
ues specified. Note that the DEFAULT clauses are not included in the
MUSIC schema table creation scripts. The DEFAULT clause is rarely used.
CREATE TABLE SALES (
SALES_ID NUMBER NOT NULL
, MUSICCD_ID NUMBER NOT NULL
, CUSTOMER_ID NUMBER NOT NULL
, RETAILER_ID NUMBER
, CONTINENT_ID NUMBER
, COUNTRY_ID NUMBER
, LIST_PRICE FLOAT DEFAULT 0
, DISCOUNT FLOAT DEFAULT 0
 
Search WWH ::




Custom Search