Code to create and populate the Premiere Products Database.docx

This preview shows page 1 - 3 out of 4 pages.

Code to create and populate the Premiere Products Database Create a database called Premiere Products and then create the following tables: CREATE TABLE Rep ( rep_num INT(5) NOT NULL, last_name VARCHAR(30) NOT NULL, first_name VARCHAR(20) NOT NULL, street VARCHAR(20) NOT NULL, city VARCHAR(20) NOT NULL, state CHAR(2) NOT NULL, zip VARCHAR(5) NOT NULL, commission FLOAT NOT NULL, rate FLOAT NOT NULL, PRIMARY KEY (rep_num) ); CREATE TABLE Customer ( customer_num INT(5) NOT NULL, customer_name VARCHAR(30) NOT NULL, street VARCHAR(20) NOT NULL, city VARCHAR(20) NOT NULL, state CHAR(2) NOT NULL, zip VARCHAR(5) NOT NULL, balance FLOAT NOT NULL, credit_limit FLOAT NOT NULL, rep_num INT(5) NOT NULL, PRIMARY KEY (customer_num), FOREIGN KEY (rep_num) REFERENCES Rep (rep_num) ); CREATE TABLE Orders ( order_num INT(10) NOT NULL, order_date DATE NOT NULL, customer_num INT (5) NOT NULL, PRIMARY KEY (order_num), FOREIGN KEY (customer_num) REFERENCES Customer (customer_num)
); CREATE TABLE Part ( part_num VARCHAR(10) NOT NULL, description VARCHAR(20) NOT NULL, on_hand INT (5) NOT NULL,

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture