forked from jaiswaladi246/Boardgame
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
38 lines (28 loc) · 1.26 KB
/
Copy pathschema.sql
File metadata and controls
38 lines (28 loc) · 1.26 KB
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
create table boardgames (
id LONG NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(128) NOT NULL,
level INT NOT NULL,
minPlayers INT NOT NULL,
maxPlayers VARCHAR(50) NOT NULL,
gameType VARCHAR(50) NOT NULL
);
create table reviews (
id LONG NOT NULL PRIMARY KEY AUTO_INCREMENT,
gameId LONG NOT NULL,
text VARCHAR(1024) NOT NULL UNIQUE
);
alter table reviews
add constraint game_review_fk foreign key (gameId)
references boardgames (id);
insert into boardgames (name, level, minPlayers, maxPlayers, gameType)
values ('Splendor', 3, 2, '4', 'Strategy Game');
insert into boardgames (name, level, minPlayers, maxPlayers, gameType)
values ('Clue', 2, 1, '6', 'Strategy Game');
insert into boardgames (name, level, minPlayers, maxPlayers, gameType)
values ('Linkee', 1, 2, '+', 'Trivia Game');
insert into reviews (gameId, text)
values (1, 'A great strategy game. The one who collects 15 points first wins. Calculation skill is required.');
insert into reviews (gameId, text)
values (1, 'Collecting gemstones makes me feel like a wealthy merchant. Highly recommend!');
insert into reviews (gameId, text)
values (2, 'A detective game to guess the criminal, weapon, and place of the crime scene. It is more fun with more than 3 players.');