-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSquishyBoots.sql
executable file
·353 lines (255 loc) · 6.96 KB
/
SquishyBoots.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
drop table Completes;
drop table Has;
drop table Carries;
drop table Enemy;
drop table Hero;
drop table Quest;
drop table Characters;
drop table Player;
drop table Location;
drop table Item;
CREATE TABLE Player (
Username varchar(80) UNIQUE,
Email varchar(80) UNIQUE,
Player_ID int,
PRIMARY KEY(Player_ID),
CONSTRAINT CHK_PID CHECK (Player_ID > 0)
);
grant select on Player to public;
CREATE TABLE Location (
Loc_ID int,
L_Name varchar(80),
City varchar(80),
Island varchar(80),
PRIMARY KEY(Loc_ID),
CONSTRAINT CHK_LID CHECK (Loc_ID > 0)
);
grant select on Location to public;
/* Cant add the ON UPDATE CASCADE */
CREATE TABLE Quest (
Q_ID int,
q_name varchar(80),
Loc_id int not NULL,
Difficulty int,
PRIMARY KEY(Q_ID),
CONSTRAINT CHK_QST CHECK (Q_ID > 0 AND Loc_id > 0),
FOREIGN KEY(Loc_id) REFERENCES Location ON DELETE CASCADE
);
grant select on Quest to public;
CREATE TABLE Characters (
HP int,
MP int,
Char_Name varchar(80),
Char_Level int,
Char_ID int,
PRIMARY KEY(Char_ID),
CONSTRAINT CHK_CHT CHECK (Char_ID > 0 AND Char_Level > 0)
);
grant select on Characters to public;
CREATE TABLE Enemy (
Enemy_Exp int,
Char_ID int,
PRIMARY KEY(Char_ID),
CONSTRAINT CHK_EMY CHECK (Char_ID > 0 AND Enemy_Exp >= 0),
FOREIGN KEY(Char_ID) REFERENCES Characters
);
grant select on Enemy to public;
CREATE TABLE Hero (
Hero_Class varchar(80),
Job varchar(80),
Quests_Completed int,
Player_ID int,
Char_ID int,
PRIMARY KEY(Char_ID),
CONSTRAINT CHK_HRO CHECK (Char_ID > 0 AND Player_ID > 0 AND Quests_Completed > 0),
FOREIGN KEY(Char_ID) REFERENCES Characters ON DELETE CASCADE,
FOREIGN KEY(Player_ID) REFERENCES Player ON DELETE CASCADE
);
grant select on Hero to public;
CREATE TABLE Item(
Item_ID int,
I_Level int,
I_Type varchar(80),
I_Name varchar(80),
I_Value int,
PRIMARY KEY(Item_ID),
CONSTRAINT CHK_ITM CHECK (Item_ID > 0 AND I_Level > 0 AND I_Value >= 0)
);
grant select on Item to public;
CREATE TABLE Carries(
Char_id int,
Item_id int,
PRIMARY KEY(Char_id, Item_id),
CONSTRAINT CHK_CAR CHECK (Char_id > 0 AND Item_id > 0),
FOREIGN KEY(Char_id) REFERENCES Hero ON DELETE CASCADE,
FOREIGN KEY(Item_id) REFERENCES Item ON DELETE CASCADE
);
grant select on Carries to public;
CREATE TABLE Completes(
Char_id int,
Q_id int,
PRIMARY KEY(Char_id, Q_id),
CONSTRAINT CHK_COM CHECK (Char_id > 0 AND Q_id > 0),
FOREIGN KEY(Char_id) REFERENCES Hero ON DELETE CASCADE,
FOREIGN KEY(Q_id) REFERENCES Quest
);
grant select on Completes to public;
CREATE TABLE Has(
Enemy_id int,
Q_id int,
PRIMARY KEY(Enemy_id, Q_id),
CONSTRAINT CHK_HAS CHECK (Enemy_id > 0 AND Q_id > 0),
FOREIGN KEY(Enemy_id) REFERENCES Enemy,
FOREIGN KEY(Q_id) REFERENCES Quest
);
grant select on Has to public;
insert into Player
values('Antipater', '[email protected]', 1);
insert into Player
values('Philippina', '[email protected]', 2);
insert into Player
values('Xoel', '[email protected]', 3);
insert into Player
values('Eadburga', '[email protected]', 4);
insert into Player
values('Jockie', '[email protected]', 5);
insert into Location
values(1, 'Road of Regrets 1', 'Temple of Time', 'Ossyria');
insert into Location
values(2, 'Time Lane: Three Doors', 'Temple of Time', 'Ossyria');
insert into Location
values(3, 'Singing Mushroom Forest: Windflower Forest', 'Henesys', 'Victoria Island');
insert into Location
values(4, 'Construction Site', 'Kerning City', 'Victoria Island');
insert into Location
values(5, 'Snail Park', 'Maple Tree Hill', 'Maple Island');
insert into Quest
values(1, '(Wanted) Green Mushrooms', 3, 0);
insert into Quest
values(2, 'Path to the Past', 2, 10);
insert into Quest
values(3, 'Keenys Research on Neo Huroid!', 4, 5);
insert into Quest
values(4, 'Keenys Research on D.Roid!!', 5, 6);
insert into Quest
values(5, 'Runaway Brother', 3, 3);
insert into Characters
values(195, 75, 'Jake', 4, 1);
insert into Characters
values(270, 20, 'David', 6, 2);
insert into Characters
values(295, 10, 'Sally', 12, 3);
insert into Characters
values(295, 10, 'Daisy', 12, 4);
insert into Characters
values(295, 10, 'Lily', 12, 5);
insert into Characters
values(300, 12, 'Peach', 55, 11);
insert into Characters
values(295, 11, 'Paul', 100, 12);
insert into Characters
values(200, 80,'Wolf', 1, 6);
insert into Characters
values(120, 250, 'Tino', 8, 7);
insert into Characters
values(15, 0, 'Snail', 1, 8);
insert into Characters
values(35, 0, 'Stump', 4, 9);
insert into Characters
values(80, 10, 'Slime', 7, 10);
insert into Enemy
values(1, 6);
insert into Enemy
values(6, 7);
insert into Enemy
values(12, 8);
insert into Enemy
values(13, 9);
insert into Enemy
values(17, 10);
insert into Hero
values('Magician', 'Luminous', 4117, 1, 5);
insert into Hero
values('Magician', 'Kinesis', 1, 2, 4);
insert into Hero
values('Warrior', 'Zero', 5490, 3, 3);
insert into Hero
values('Bowman', 'Mercedes', 588, 4, 2);
insert into Hero
values('Pirate', 'Mechanic', 711, 5, 1);
insert into Hero
values('Bowman', 'Mercedes', 1001, 5, 11);
insert into Hero
values('Warrio', 'Zero', 1002, 3, 12);
insert into Item
values(1, 22, 'hat', 'Mithril Sharp Helm', 100);
insert into Item
values(2, 30, 'shoes', 'Squishy Shoes', 200);
insert into Item
values(3, 20, 'claws', 'Adamantium Igor', 150);
insert into Item
values(4, 120, 'gun', 'Reverse Blindness', 1000);
insert into Item
values(5, 20, 'spear', 'Bamboo Spears', 90);
insert into Item
values(6, 10, 'hat', 'Brown Rocky Bandana', 90);
insert into Item
values(7, 10, 'hat', 'Red Misty', 2000);
insert into Item
values(8, 10, 'shield', 'Esther Shield', 120);
insert into Item
values(9, 10, 'shield', 'Maple Magician Shield', 220);
insert into Carries
values(3, 2);
insert into Carries
values(2, 3);
insert into Carries
values(4, 4);
insert into Carries
values(1, 1);
insert into Carries
values(5, 5);
insert into Carries
values(11, 5);
insert into Carries
values(12, 2);
insert into Carries
values(3, 6);
insert into Carries
values(2, 7);
insert into Carries
values(4, 8);
insert into Carries
values(1, 9);
insert into Carries
values(5, 6);
insert into Carries
values(11, 7);
insert into Carries
values(12, 8);
insert into Completes
values(2, 1);
insert into Completes
values(3, 2);
insert into Completes
values(4, 3);
insert into Completes
values(2, 4);
insert into Completes
values(3, 5);
insert into Completes
values(2, 2);
insert into Completes
values(2, 3);
insert into Completes
values(2, 5);
insert into Has
values(6, 1);
insert into Has
values(7, 2);
insert into Has
values(8, 3);
insert into Has
values(9, 4);
insert into Has
values(10, 5);