-
Notifications
You must be signed in to change notification settings - Fork 2
/
db.sql
316 lines (261 loc) · 10.6 KB
/
db.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
-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Aug 31, 2023 at 08:43 AM
-- Server version: 8.0.33
-- PHP Version: 8.2.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
--
-- Database: `osn`
--
-- --------------------------------------------------------
--
-- Table structure for table `Committee`
--
CREATE TABLE `Committee` (
`ID` int NOT NULL,
`Competition` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`Person` int NOT NULL,
`Role` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`Chair` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'N'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `Competition`
--
CREATE TABLE `Competition` (
`ID` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`Level` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`Year` int NOT NULL,
`Name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`ShortName` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`Host` char(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`HostCountryCode` char(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`HostCountryName` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`City` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`DateBegin` date DEFAULT NULL,
`DateEnd` date DEFAULT NULL,
`ScorePr` int DEFAULT NULL,
`Started` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Y',
`Finished` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Y',
`DataComplete` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Y',
`Note` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `Competition`
--
INSERT INTO `Competition` (`ID`, `Level`, `Year`, `Name`, `ShortName`, `Host`, `HostCountryCode`, `HostCountryName`, `City`, `DateBegin`, `DateEnd`, `ScorePr`, `Started`, `Finished`, `DataComplete`, `Note`) VALUES
('APIO2020', 'Regional', 2020, 'Asia-Pacific Informatics Olympiad 2020', 'APIO 2020', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'Y', 'Y', NULL),
('APIO2021', 'Regional', 2021, 'Asia-Pacific Informatics Olympiad 2021', 'APIO 2021', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'Y', 'Y', NULL),
('IOI2020', 'International', 2020, 'International Olympiad in Informatics 2020', 'IOI 2020', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'Y', 'Y', NULL),
('IOI2021', 'International', 2021, 'International Olympiad in Informatics 2021', 'IOI 2021', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Y', 'Y', 'Y', NULL),
('OSN2019', 'National', 2019, 'Olimpiade Sains Nasional 2019 Bidang Informatika', 'OSN 2019', 'SAZ', NULL, NULL, 'Manado', '2019-06-30', '2019-07-06', 0, 'Y', 'Y', 'Y', NULL);
-- --------------------------------------------------------
--
-- Table structure for table `Contestant`
--
CREATE TABLE `Contestant` (
`ID` int NOT NULL,
`Competition` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`Person` int NOT NULL,
`School` int DEFAULT NULL,
`Province` char(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`Gender` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`Grade` int DEFAULT NULL,
`TeamNo` int NOT NULL DEFAULT '1',
`Score` decimal(8,2) DEFAULT NULL,
`ScoreMark` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`Rank` int DEFAULT NULL,
`Medal` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `Contestant`
--
INSERT INTO `Contestant` (`ID`, `Competition`, `Person`, `School`, `Province`, `Gender`, `Grade`, `TeamNo`, `Score`, `Rank`, `Medal`) VALUES
(1160, 'OSN2019', 1001, 27, 'JTZ', NULL, NULL, 1, '563.00', 2, 'G'),
(1279, 'IOI2020', 1001, 27, NULL, NULL, NULL, 1, NULL, 13, 'G'),
(1285, 'APIO2020', 1001, 27, NULL, NULL, NULL, 1, NULL, 43, 'S'),
(1659, 'APIO2021', 1001, 27, NULL, NULL, NULL, 1, NULL, 25, 'S'),
(1663, 'IOI2021', 1001, 27, NULL, NULL, NULL, 1, NULL, 28, 'G');
-- --------------------------------------------------------
--
-- Table structure for table `Person`
--
CREATE TABLE `Person` (
`ID` int NOT NULL,
`Name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `Person`
--
INSERT INTO `Person` (`ID`, `Name`) VALUES
(1001, 'Pikatan Arya Bramajati');
-- --------------------------------------------------------
--
-- Table structure for table `Province`
--
CREATE TABLE `Province` (
`ID` char(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`Name` varchar(75) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `Province`
--
INSERT INTO `Province` (`ID`, `Name`) VALUES
('JTZ', 'Jawa Tengah'),
('SAZ', 'Sulawesi Utara');
-- --------------------------------------------------------
--
-- Table structure for table `School`
--
CREATE TABLE `School` (
`ID` int NOT NULL,
`Name` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `School`
--
INSERT INTO `School` (`ID`, `Name`) VALUES
(27, 'SMA Semesta BBS Semarang');
-- --------------------------------------------------------
--
-- Table structure for table `Submission`
--
CREATE TABLE `Submission` (
`ID` int NOT NULL,
`Contestant` int NOT NULL,
`Task` int NOT NULL,
`Score` decimal(6,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `Submission`
--
INSERT INTO `Submission` (`ID`, `Contestant`, `Task`, `Score`) VALUES
(4193, 1160, 49, '100.00'),
(4194, 1160, 50, '75.00'),
(4195, 1160, 51, '88.00'),
(4196, 1160, 52, '100.00'),
(4197, 1160, 53, '100.00'),
(4198, 1160, 54, '100.00');
-- --------------------------------------------------------
--
-- Table structure for table `Task`
--
CREATE TABLE `Task` (
`ID` int NOT NULL,
`Competition` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`DayNo` int NOT NULL,
`TaskNo` int NOT NULL,
`Alias` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`Name` varchar(75) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`MaxScore` decimal(6,2) DEFAULT NULL,
`ScorePr` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `Task`
--
INSERT INTO `Task` (`ID`, `Competition`, `DayNo`, `TaskNo`, `Alias`, `Name`, `MaxScore`, `ScorePr`) VALUES
(49, 'OSN2019', 1, 1, '1A', 'Mengumpulkan Peserta', '100.00', 0),
(50, 'OSN2019', 1, 2, '1B', 'Pertahanan Manado', '100.00', 0),
(51, 'OSN2019', 1, 3, '1C', 'Rekreasi OSN', '100.00', 0),
(52, 'OSN2019', 2, 4, '2A', 'Tempat Wisata', '100.00', 0),
(53, 'OSN2019', 2, 5, '2B', 'Mencari Emas', '100.00', 0),
(54, 'OSN2019', 2, 6, '2C', 'Penyebaran Hoaks', '100.00', 0);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `Committee`
--
ALTER TABLE `Committee`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `Competition_Person_Role` (`Competition`,`Person`,`Role`) USING BTREE,
ADD KEY `Person` (`Person`),
ADD KEY `Competition` (`Competition`) USING BTREE;
--
-- Indexes for table `Competition`
--
ALTER TABLE `Competition`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `Level_Year` (`Level`,`Year`),
ADD KEY `Host` (`Host`);
--
-- Indexes for table `Contestant`
--
ALTER TABLE `Contestant`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `Competition_Person` (`Competition`,`Person`),
ADD KEY `Person` (`Person`),
ADD KEY `Province` (`Province`) USING BTREE,
ADD KEY `School` (`School`);
--
-- Indexes for table `Person`
--
ALTER TABLE `Person`
ADD PRIMARY KEY (`ID`),
ADD KEY `Name` (`Name`);
--
-- Indexes for table `Province`
--
ALTER TABLE `Province`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `School`
--
ALTER TABLE `School`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `Name` (`Name`);
--
-- Indexes for table `Submission`
--
ALTER TABLE `Submission`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `Contestant_Task` (`Contestant`,`Task`),
ADD KEY `Contestant` (`Contestant`),
ADD KEY `Task` (`Task`);
--
-- Indexes for table `Task`
--
ALTER TABLE `Task`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `Competition_DayNo_TaskNo` (`Competition`,`DayNo`,`TaskNo`),
ADD UNIQUE KEY `Competition_Alias` (`Competition`,`Alias`),
ADD KEY `Competition` (`Competition`) USING BTREE;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `Committee`
--
ALTER TABLE `Committee`
ADD CONSTRAINT `Committee_ibfk_1` FOREIGN KEY (`Person`) REFERENCES `Person` (`ID`) ON DELETE RESTRICT ON UPDATE RESTRICT,
ADD CONSTRAINT `Committee_ibfk_2` FOREIGN KEY (`Competition`) REFERENCES `Competition` (`ID`) ON DELETE RESTRICT ON UPDATE RESTRICT;
--
-- Constraints for table `Competition`
--
ALTER TABLE `Competition`
ADD CONSTRAINT `Competition_ibfk_1` FOREIGN KEY (`Host`) REFERENCES `Province` (`ID`) ON DELETE RESTRICT ON UPDATE RESTRICT;
--
-- Constraints for table `Contestant`
--
ALTER TABLE `Contestant`
ADD CONSTRAINT `Contestant_ibfk_1` FOREIGN KEY (`Person`) REFERENCES `Person` (`ID`) ON DELETE RESTRICT ON UPDATE CASCADE,
ADD CONSTRAINT `Contestant_ibfk_2` FOREIGN KEY (`Province`) REFERENCES `Province` (`ID`) ON DELETE RESTRICT ON UPDATE RESTRICT,
ADD CONSTRAINT `Contestant_ibfk_3` FOREIGN KEY (`Competition`) REFERENCES `Competition` (`ID`) ON DELETE RESTRICT ON UPDATE RESTRICT,
ADD CONSTRAINT `Contestant_ibfk_4` FOREIGN KEY (`School`) REFERENCES `School` (`ID`) ON DELETE RESTRICT ON UPDATE RESTRICT;
--
-- Constraints for table `Submission`
--
ALTER TABLE `Submission`
ADD CONSTRAINT `Submission_ibfk_1` FOREIGN KEY (`Contestant`) REFERENCES `Contestant` (`ID`) ON DELETE RESTRICT ON UPDATE CASCADE,
ADD CONSTRAINT `Submission_ibfk_2` FOREIGN KEY (`Task`) REFERENCES `Task` (`ID`) ON DELETE RESTRICT ON UPDATE CASCADE;
--
-- Constraints for table `Task`
--
ALTER TABLE `Task`
ADD CONSTRAINT `Task_ibfk_1` FOREIGN KEY (`Competition`) REFERENCES `Competition` (`ID`) ON DELETE RESTRICT ON UPDATE RESTRICT;
COMMIT;