drop table if exists item;
drop table if exists ord;
drop table if exists product;
drop table if exists customer;
create table customer(
customer_id bigint not null,
name varchar not null,
address_line_1 varchar not null,
address_line_2 varchar,
city varchar not null,
state char(2) not null,
zip char(5) not null,
phone varchar,
primary key(customer_id));
|
create table product(
product_id bigint not null,
manufacturer varchar not null,
description varchar not null,
model_number varchar,
price decimal(10, 2) not null,
primary key(product_id));
create table ord(
ord_id bigint not null,
customer_id bigint not null references customer,
ord_date date,
package_tracking varchar,
primary key(ord_id));
create table item(
ord_id bigint not null references ord,
line_number int not null,
quantity int not null,
product_id bigint references product,
primary key(ord_id, line_number));
|