-
Notifications
You must be signed in to change notification settings - Fork 0
/
DDL.sql
46 lines (36 loc) · 989 Bytes
/
DDL.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
drop table borrowings;
drop table bookRequests;
drop table books;
drop table members;
CREATE TABLE Books (
book_id INTEGER PRIMARY KEY,
title VARCHAR(30),
author VARCHAR(25),
publisher VARCHAR(25),
publish_year INTEGER,
total_quantity INTEGER,
available_quantity INTEGER
);
CREATE TABLE Members (
member_id INTEGER PRIMARY KEY,
first_name VARCHAR(15),
last_name VARCHAR(15),
email VARCHAR(35),
phone VARCHAR(20),
address VARCHAR(25)
);
CREATE TABLE Borrowings (
borrowing_id INTEGER PRIMARY KEY,
book_id INTEGER REFERENCES Books(book_id),
member_id INTEGER REFERENCES Members(member_id),
borrowing_date DATE,
due_date DATE,
return_date DATE
);
CREATE TABLE BookRequests (
request_id INTEGER PRIMARY KEY,
book_id INTEGER REFERENCES Books(book_id),
member_id INTEGER REFERENCES Members(member_id),
request_date DATE,
status VARCHAR(15)
);