-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshema.sql
59 lines (53 loc) · 1.35 KB
/
shema.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
57
58
59
CREATE TABLE author (
id SERIAl PRIMARY KEY,
first_name VARCHAR(10) NOT NULL,
last_name VARCHAR(10) NOT NULL
);
CREATE TABLE item (
id SERIAl PRIMARY KEY,
publish_date DATE NOT NULL,
FOREIGN KEY (id) REFERENCES author (id)
);
CREATE TABLE book(
ID SERIAL PRIMARY KEY,
publish_date DATE NOT NULL,
archived BOOLEAN NOT NULL,
publisher VARCHAR(30) NOT NULL,
cover_state VARCHAR(10) NOT NULL,
author_ID INT,
genre_ID INT,
label_ID INT,
FOREIGN KEY (label_ID) REFERENCES label(ID),
FOREIGN KEY (author_ID) REFERENCES author(ID),
FOREIGN KEY(genre_ID) REFERENCES genre(ID)
);
CREATE TABLE game (
id SERIAl PRIMARY KEY,
publish_date DATE NOT NULL,
archived BOOLEAN,
FOREIGN KEY (id) REFERENCES genre(id),
FOREIGN KEY (id) REFERENCES author(id),
FOREIGN KEY (id) REFERENCES label(id),
FOREIGN KEY (id) REFERENCES source(id)
);
CREATE TABLE genre(
id SERIAl PRIMARY KEY,
name VARCHAR(100),
)
CREATE TABLE label(
ID SERIAL PRIMARY KEY,
title VARCHAR(50),
color VARCHAR(30),
);
CREATE TABLE musicALbum (
id SERIAL PRIMARY KEY,
publish_date DATE,
archived BOOLEAN,
on_spotify BOOLEAN,
genre_id INT,
author_id INT,
label_id INT,
FOREIGN KEY (genre_id) REFERENCES genre(id),
FOREIGN KEY (author_id) REFERENCES author(id),
FOREIGN KEY (label_id) REFERENCES label(id),
)