RelationalDesign: PolnenjeTabeli.sql

File PolnenjeTabeli.sql, 5.6 KB (added by 201100, 18 months ago)
Line 
1truncate table administrator restart identity cascade;
2truncate table attempt restart identity cascade;
3truncate table badge restart identity cascade;
4truncate table badge_is_awarded_to_quiztaker restart identity cascade;
5truncate table category restart identity cascade;
6truncate table choice restart identity cascade;
7truncate table hint restart identity cascade;
8truncate table user_table restart identity cascade;
9truncate table medal restart identity cascade;
10truncate table medal_is_awarded_to_quiztaker restart identity cascade;
11truncate table moderator restart identity cascade;
12truncate table question restart identity cascade;
13truncate table question_is_part_of_quiz restart identity cascade;
14truncate table quiz restart identity cascade;
15truncate table quiz_is_part_of_tournament restart identity cascade;
16truncate table quiztaker restart identity cascade;
17truncate table quiztaker_participates_in_tournament restart identity cascade;
18truncate table quiztaker_participates_in_tournamentphase restart identity cascade;
19truncate table result_table restart identity cascade;
20truncate table selectedchoice restart identity cascade;
21truncate table selectionquestion restart identity cascade;
22truncate table subject restart identity cascade;
23truncate table textquestion restart identity cascade;
24truncate table tournament restart identity cascade;
25truncate table tournamentorganizer restart identity cascade;
26truncate table tournamentorganizer_hosts_tournament restart identity cascade;
27truncate table tournamentphase restart identity cascade;
28truncate table quiz_is_part_of_tournamentphase restart identity cascade;
29
30insert into user_table(fullname, username, password_attr) values
31('Kliment Shukanov', 'shukan123', 'User321!'),
32('Petar Pucoski', 'perikus123', 'najsecurelozinka'),
33('Stefan Risteski', 'fankyoste', 'password_attr123'),
34('Petre Petreski', 'mitre123', 'pass123'),
35('Kiril Lazarov', 'kirilLazarov', 'pass321'),
36('Quiz Tester', 'quizTester', 'pass321123!'),
37('Stevo Stevoski', 'stefs', 'asdjkdas'),
38('Stole Dimitrieski', 'stoleGK', 'gk123321'),
39('Quiz Tester 2', 'quizTester2', 'pass32112332!');
40
41insert into administrator (userID) values
42 (1), (2), (3);
43
44insert into moderator (userID) values
45 (4), (5), (6);
46
47insert into quiztaker(userid) values
48 (7), (8), (9);
49
50insert into tournament(tournamentname) values
51('History Quiz Tournament'),
52('General Sport Knowledge Test'),
53('Geography Tournament');
54
55insert into tournamentphase(tournamentid, tournamentphasename) values
56 (1, 'First phase'), (1, 'Semi-finals'), (1, 'Finals'), (2, 'Phase 1'), (2, 'Phase 2'), (2, 'Phase 3'), (2, 'Phase 4'), (2, 'Grand final'), (3, 'First phase'), (3, 'Second phase');
57
58insert into tournamentorganizer(userid) values
59 (4), (5), (6);
60
61insert into subject(subjectname) values
62 ('History'), ('Sport'), ('Geography'), ('Physics');
63
64insert into category(subjectid, categoryname) values
65 (1, 'World War 1'), (1, 'World War 2'), (1, 'Balkan Wars'),
66 (2, 'Football'), (2, 'Basketball'), (3, 'Europe'), (3, 'Asia');
67
68insert into quiz(categoryid, quizname, tournamentphaseid) values
69 (2, 'World War 2 Trivia'),
70 (4, 'Football Legends'),
71 (5, 'Basketball legends'),
72 (6, 'European Landmarks'),
73 (4, 'Champions league');
74
75
76insert into medal(tournamentid, medalname, description) values
77 (2, 'Sports-wiz', 'Your knowledge of sports is impeccable'),
78 (1, 'History nerd', 'You are a true historian'),
79 (3, 'Geography geek', 'Master of geography');
80
81insert into question(questiontext) values
82 ('Who got the Rookie of the Year award in 2021'),
83 ('Give your opinion on who will win the 2022 season and why?'),
84 ('Guess this flag?'),
85 ('What is the capital of Germany?'),
86 ('Who won the 2010 World Cup?'),
87 ('What is the most populated nation in Asia?');
88
89insert into hint(hinttext, questionid) values
90 ('This player plays in Charlotte Hornets', 1),
91 ('It is a country in the north of Europe', 3),
92 ('Their nickname is the Red Furia', 5);
93
94insert into textquestion (questionid) values
95 (2), (4), (6);
96
97insert into selectionquestion (questionid) values
98 (1), (3), (5);
99
100insert into choice(questionid, iscorrect, choicetext) values
101 (1, true, 'LaMelo Ball'),
102 (1, false, 'Luka Doncic'),
103 (1, false, 'Nikola Jokic');
104
105insert into attempt(userid, attemptdate, quizid) values
106 (7, '12/10/2021', 3),
107 (8, '11/10/2021', 3),
108 (9, '10/10/2021', 3);
109
110insert into selectedchoice(choiceid, attemptid) values
111 (2, 1), (3, 2), (1, 3);
112
113insert into result_table(attemptid, points) values
114 (1, 0), (2, 0), (3, 100);
115
116insert into badge(resultid, badgename , description) values
117 (1, 'High performance', 'You scored a score above 90 points'),
118 (2, 'Participation badge', 'At least you tried'),
119 (3, 'Basketball maniac', 'Score above 90 points on a quiz about basketball');
120
121insert into quiz_is_part_of_tournament(quizid, tournamentid) values
122 (5, 2), (1, 1), (3,2);
123
124insert into quiz_is_part_of_tournamentphase (quizid, tournamentphaseid) values
125 (5, 8), (1, 1), (3, 7);
126
127insert into tournamentorganizer_hosts_tournament (userid , tournamentid) values
128 (1,2), (2,1), (3,3);
129
130insert into question_is_part_of_quiz(questionid, quizid) values
131 (1,3), (2, 3), (9, 4);
132
133insert into quiztaker_participates_in_tournamentphase (userid, tournamentphaseid) values
134 (7, 8), (8, 2), (9, 3);
135
136insert into quiztaker_participates_in_tournament (userid, tournamentid) values
137 (7, 2), (8, 1), (9,1);
138
139insert into medal_is_awarded_to_quiztaker (medalid, userid) values
140 (2, 7), (2, 8), (1, 9);
141
142insert into badge_is_awarded_to_quiztaker (badgeid, userid) values
143 (2,7), (2, 8), (3, 9);
144