Creating the Sample Tables

The following scripts can be used to create the five sample tables. Please note that these scripts have been designed for maximum compatibility among as many different DBMSs as possible. Because of this, the scripts are neither optimized nor complete. Each script is followed by notes that describe some changes or additions you may need (or want) to make.

Caution

Please read the bulleted notes that appear after each script before actually executing it.

The VENDORS Table

CREATE TABLE Vendors
(
    vend_id        CHAR(10)    NOT NULL,
    vend_name    CHAR(50)    NOT NULL,
    vend_address    CHAR(50)    ,
    vend_city    CHAR(50)    ,
    vend_state    CHAR        ,
    vend_zip    CHAR(10)
);
  • All tables should have primary keys defined. This table should use vend_id as its primary ...

Get Sams Teach Yourself SQL in 10 Minutes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.