-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.sql
62 lines (38 loc) · 994 Bytes
/
database.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
48
49
50
51
52
53
54
55
56
CREATE TABLE category (
categoryId SERIAL PRIMARY KEY,
categoryName VARCHAR(25),
UNIQUE (categoryName)
);
CREATE TABLE flower (
flowerId SERIAL PRIMARY KEY,
flowerName VARCHAR,
flowerPrice INT,
flowerInformation VARCHAR(25),
categoryId INT,
FOREIGN KEY (categoryId) REFERENCES category(categoryId)
);
CREATE TABLE advertising (
cardId SERIAL PRIMARY KEY,
discount VARCHAR,
infromation VARCHAR
);
CREATE TABLE users (
userId SERIAL PRIMARY KEY,
username VARCHAR,
login VARCHAR,
password INT
);
CREATE TABLE basket (
basketId SERIAL PRIMARY KEY,
flowerId INT,
userId INT,
FOREIGN KEY(userId) REFERENCES users (userId),
FOREIGN KEY (flowerId) REFERENCES flower (flowerId)
);
CREATE TABLE favorite (
favoritId SERIAL PRIMARY KEY,
flowerId INT,
userId INT,
FOREIGN KEY(userId) REFERENCES users(userId),
FOREIGN KEY (flowerId) REFERENCES flower(flowerId)
);