-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbookstoreDDL.sql
48 lines (43 loc) · 1.02 KB
/
bookstoreDDL.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--drop table books;
--drop table reviews;
--drop table orders;
--drop table customer;
create table books(
ISBN numeric(13,0),
title text,
Author text,
publisher text,
category text,
price numeric(5,2),
primary key (ISBN)
);
create table customer(
username varchar(255),
pin text,
fname text,
lname text,
custaddress text,
city text,
custState char(2),
cardType text,
cardNo varchar(255),
primary key(username)
);
create table reviews(
reviewID int,
reviewText text,
ISBN numeric(13,0),
primary key(reviewID),
foreign key(ISBN) references books(ISBN)
);
create table orders(
orderID int,
customerUsername varchar(255),
ISBN numeric(13,0),
quantity int,
orderDate date,
totalPrice numeric(5,2),
primary key(orderID,ISBN),
foreign key(ISBN) references books(ISBN),
foreign key(customerUsername) references customer(username)
);