CREATE TABLE dream_customer
(
cid CHAR(8),
name VARCHAR(30),
street VARCHAR(100),
city VARCHAR(20),
state CHAR(2),
zip CHAR(5),
phone CHAR(10),
email VARCHAR(30),
username VARCHAR(16),
password VARCHAR(16),
ship_street VARCHAR(100),
ship_city VARCHAR(20),
ship_state CHAR(2),
ship_zip CHAR(5),
constraint cd1 primary key(cid)
);
CREATE TABLE dream_seller
(
sid CHAR(8),
rate INTEGER,
rate_comment VARCHAR(100),
constraint cd2 primary key(sid),
constraint cd3 foreign key(sid) references dream_customer(cid)
);
CREATE TABLE dream_posting
(
pid CHAR(6),
name VARCHAR(20),
start_date DATE,
end_date DATE,
quantity INTEGER,
first_bid REAL,
catagory VARCHAR(20),
description VARCHAR(100),
city VARCHAR(20),
state CHAR(2),
sid CHAR(8),
constraint cd4 primary key(pid),
constraint cd5 foreign key(sid) references dream_customer(cid)
);
CREATE TABLE dream_bidding
(
bid CHAR(8),
sid CHAR(8),
pid CHAR(6),
bid_price REAL,
bid_date DATE,
constraint cd6 primary key(bid, sid, pid, bid_price),
constraint cd7 foreign key(bid) references dream_customer(cid),
constraint cd8 foreign key(sid) references dream_seller(sid),
constraint cd9 foreign key(pid) references dream_posting(pid)
);