-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathddl.sql
More file actions
38 lines (34 loc) · 975 Bytes
/
ddl.sql
File metadata and controls
38 lines (34 loc) · 975 Bytes
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
CREATE SCHEMA bookStoreTest;
USE bookStoreTest;
CREATE TABLE orders (
id int primary key auto_increment,
customerName varchar(50) not null,
customerMail varchar(50) not null,
closedDate datetime,
status varchar(50) not null,
totalPrice decimal(15,2) not null
);
CREATE TABLE books (
id int primary key auto_increment,
title varchar(50) not null,
author varchar(50) not null,
isInStock bool not null,
publishDate datetime not null,
price decimal(15,2) not null,
incomeDate datetime not null,
description varchar(2000)
);
CREATE TABLE requests (
id int primary key auto_increment,
dateCreated datetime not null,
isClosed bool not null,
bookId int not null,
foreign key(bookId) references books(id)
);
CREATE TABLE orderBooks (
id int primary key auto_increment,
orderId int not null,
bookId int not null,
foreign key(orderId) references orders(id),
foreign key(bookId) references books(id)
);