-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sql
623 lines (484 loc) · 18.1 KB
/
setup.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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
/* #### Tables #### */
/* Departments */
CREATE TABlE Departments
( department_abbreviation VARCHAR(10),
department_name VARCHAR(50),
PRIMARY KEY (department_abbreviation),
UNIQUE (department_name)
);
/* Programmes */
CREATE TABLE Programmes
( programme_abbreviation VARCHAR(10),
programme_name VARCHAR(50),
PRIMARY KEY (programme_abbreviation),
UNIQUE (programme_name)
);
/* Branches */
CREATE TABLE Branches
( branch VARCHAR(50),
programme_abbreviation VARCHAR(10),
FOREIGN KEY (programme_abbreviation) REFERENCES Programmes(programme_abbreviation),
PRIMARY KEY (branch, programme_abbreviation)
);
/* Students */
CREATE TABLE Students
( student_id INT CHECK (LENGTH(student_id) = 10) NOT NULL,
student_name VARCHAR(50),
branch VARCHAR(50),
programme_abbreviation VARCHAR(10),
PRIMARY KEY (student_id),
FOREIGN KEY (branch, programme_abbreviation) REFERENCES Branches(branch, programme_abbreviation)
);
/* Courses */
CREATE TABLE Courses
( code VARCHAR(6),
course_name VARCHAR (50),
credit INT,
PRIMARY KEY (code)
);
/* RestrictedCourses */
CREATE TABLE RestrictedCourses
( code VARCHAR(6),
attendees INT,
PRIMARY KEY (code),
FOREIGN KEY (code) REFERENCES Courses(code)
);
/* Classifications */
CREATE TABLE Classifications
( classification VARCHAR(50),
PRIMARY KEY (classification)
);
/* isHosting */
CREATE TABLE isHosting
( department_abbreviation VARCHAR(10),
programme_abbreviation VARCHAR(10),
FOREIGN KEY(department_abbreviation) REFERENCES Departments(department_abbreviation),
FOREIGN KEY(programme_abbreviation) REFERENCES Programmes(programme_abbreviation)
);
/* attendsTo */
/* Obsolete? Isn't used anywhere. */
CREATE TABLE attendsTo
( student_id INT,
programme_abbreviation VARCHAR(10),
branch VARCHAR(50),
FOREIGN KEY (student_id) REFERENCES Students(student_id),
FOREIGN KEY (branch, programme_abbreviation) REFERENCES Branches(branch, programme_abbreviation)
);
/* hasCompleted */
CREATE TABLE hasCompleted
( student_id INT,
code VARCHAR(6),
grade VARCHAR(1),
FOREIGN KEY (student_id) REFERENCES Students(student_id),
FOREIGN KEY (code) REFERENCES Courses(code),
CONSTRAINT GradeCheck CHECK (grade in ('3', '4', '5', 'U'))
);
/* hasRegistered */
CREATE TABLE hasRegistered
( student_id INT,
code VARCHAR(6),
FOREIGN KEY (student_id) REFERENCES Students(student_id),
FOREIGN KEY (code) REFERENCES Courses(code)
);
/* recommendedCourse */
CREATE TABLE recommendedCourse
( code VARCHAR(6),
programme_abbreviation VARCHAR(10),
branch VARCHAR(50),
FOREIGN KEY (code) REFERENCES Courses(code),
FOREIGN KEY (branch, programme_abbreviation) REFERENCES Branches(branch, programme_abbreviation)
);
/* branchMandatory */
CREATE TABLE branchMandatory
( code VARCHAR(6),
programme_abbreviation VARCHAR(10),
branch VARCHAR(50),
FOREIGN KEY (code) REFERENCES Courses(code),
FOREIGN KEY (branch, programme_abbreviation) REFERENCES Branches(branch, programme_abbreviation)
);
/* programmeMandatory */
CREATE TABLE programmeMandatory
( code VARCHAR(6),
programme_abbreviation VARCHAR(10),
FOREIGN KEY (code) REFERENCES Courses(code),
FOREIGN KEY (programme_abbreviation) REFERENCES Programmes(programme_abbreviation)
);
/* belongsTo */
/* Does it work correctly? */
CREATE TABLE belongsTo
( branch VARCHAR(50),
programme_abbreviation VARCHAR(10),
FOREIGN KEY (branch, programme_abbreviation) REFERENCES Branches(branch, programme_abbreviation)
);
/* isGiven */
CREATE TABLE isGiven
( code VARCHAR(6),
department_abbreviation VARCHAR(10),
FOREIGN KEY (code) REFERENCES Courses(code),
FOREIGN KEY (department_abbreviation) REFERENCES Departments(department_abbreviation)
);
/* hasClassifications */
CREATE TABLE hasClassifications
( code VARCHAR(6),
classification VARCHAR(50),
FOREIGN KEY (code) REFERENCES Courses(code),
FOREIGN KEY (classification) REFERENCES Classifications(classification)
);
/* prerequisites */
CREATE TABLE prerequisites
( code1 VARCHAR(6),
code2 VARCHAR(6),
FOREIGN KEY (code1) REFERENCES Courses(code),
FOREIGN KEY (code2) REFERENCES Courses(code)
);
/* isWaiting */
CREATE TABLE isWaiting
( code VARCHAR(6),
student_id INT,
placeInQueue INT,
FOREIGN KEY (code) REFERENCES Courses(code),
FOREIGN KEY (student_id) REFERENCES Students(student_id),
CONSTRAINT isWaitingUnique UNIQUE (code, placeInQueue)
);
/* #### Views #### */
CREATE VIEW CourseView AS
SELECT * FROM Courses;
/* StudentsFollowing */
CREATE VIEW StudentsFollowing AS
SELECT student_id, student_name, branch, programme_abbreviation
FROM Students;
/* Finished Courses */
CREATE VIEW FinishedCourses AS
SELECT hC.student_id, hC.code, hC.grade, Courses.credit
FROM hasCompleted hC
INNER JOIN Courses ON hC.code = Courses.code;
/* Registrations */
CREATE VIEW Registrations AS
SELECT student_id, code, 'Registered' AS status
FROM hasRegistered
UNION
SELECT student_id, code, 'Waiting' AS status
FROM isWaiting;
/* PassedCourses */
CREATE VIEW PassedCourses AS
SELECT hC.student_id, hC.code, hC.grade, Courses.credit
FROM hasCompleted hC
INNER JOIN Courses ON hC.code = Courses.code
WHERE (hC.grade != 'U');
/* UnreadMandatory */
CREATE VIEW UnreadMandatory AS
SELECT s.student_id, bM.code
FROM Students s
INNER JOIN branchMandatory bM ON s.programme_abbreviation = bM.programme_abbreviation AND s.branch = bM.branch
UNION
SELECT s.student_id, pM.code
FROM Students s
INNER JOIN programmeMandatory pM ON s.programme_abbreviation = pM.programme_abbreviation
MINUS
SELECT student_id, code
FROM hasCompleted hC
WHERE hC.grade != 'U';
/* PathToGraduation */
CREATE VIEW pathToGraduationHelper AS
SELECT s.student_id, pC.code, pC.credit FROM StudentsFollowing s
INNER JOIN PassedCourses pC ON s.student_id = pC.student_id
INNER JOIN branchMandatory bM ON s.programme_abbreviation = bM.programme_abbreviation
AND s.branch = bM.branch AND pC.code = bM.code;
CREATE VIEW PathToGraduation AS
WITH
Credits AS (
SELECT pC.student_id, SUM(pC.credit) AS Credits
FROM PassedCourses pC
INNER JOIN Courses ON pC.code = Courses.code
GROUP BY student_id
),
Credits_Branch AS (
SELECT pGH.student_id, SUM(pGH.credit) AS Credits_Branch
FROM pathToGraduationHelper pGH
GROUP BY student_id
),
Mandatory AS (
SELECT uM.student_id, COUNT(uM.code) AS Mandatory
FROM UnreadMandatory uM
GROUP BY student_id
),
Seminars AS (
SELECT pC.student_id, COUNT(pC.code) AS Seminars
FROM PassedCourses pC
INNER JOIN hasClassifications hC ON pC.code = hC.code AND hC.classification = 'Seminar'
INNER JOIN Courses ON pC.code = Courses.code
GROUP BY student_id
),
Credits_Math AS (
SELECT pC.student_id, SUM(pC.credit) AS Credits_Math
FROM PassedCourses pC
INNER JOIN hasClassifications hC ON pC.code = hC.code AND hC.classification = 'Math'
GROUP BY student_id
),
Credits_Research AS (
SELECT pC.student_id, SUM(pC.credit) AS Credits_Research
FROM PassedCourses pC
INNER JOIN hasClassifications hC ON pC.code = hC.code AND hC.classification = 'Research'
GROUP BY student_id
)
SELECT stud.student_id AS Student,
NVL(Credits, '0') AS Credits,
NVL(Credits_Branch, '0') AS Credits_Branch,
NVL(Mandatory, '0') AS Mandatory,
NVL(Seminars, '0') AS Seminars,
NVL(Credits_Math, '0') AS Credits_Math,
NVL(Credits_Research, '0') AS Credits_Research,
(CASE WHEN
Credits_Math >= 20
AND Credits_Research >= 10
AND Seminars >= 1
AND Mandatory IS NULL
THEN 'Done'
ELSE 'Not done'
END)
AS Status
FROM Students stud
LEFT JOIN Credits ON stud.student_id = Credits.student_id
LEFT JOIN Credits_Branch ON stud.student_id = Credits_Branch.student_id
LEFT JOIN Mandatory ON stud.student_id = Mandatory.student_id
LEFT JOIN Seminars ON stud.student_id = Seminars.student_id
LEFT JOIN Credits_Math ON stud.student_id = Credits_Math.student_id
LEFT JOIN Credits_Research ON stud.student_id = Credits_Research.student_id;
/* #### Inserts #### */
/* Department */
INSERT INTO Departments(department_abbreviation, department_name)
VALUES ('SSY', 'SignalerSystem');
INSERT INTO Departments(department_abbreviation, department_name)
VALUES('IT', 'Informationsteknik');
INSERT INTO Departments(department_abbreviation, department_name)
VALUES('CSE', 'Datainstitutionen');
/* Programme */
INSERT INTO Programmes(programme_abbreviation, programme_name)
VALUES('IT', 'IT-programmet');
INSERT INTO Programmes(programme_abbreviation, programme_name)
VALUES('M', 'Maskin-programmet');
INSERT INTO Programmes(programme_abbreviation, programme_name)
VALUES('D', 'D-programmet');
INSERT INTO Programmes(programme_abbreviation, programme_name)
VALUES('A', 'A-programmet');
/* Branch */
INSERT INTO Branches(branch, programme_abbreviation)
VALUES('CSN', 'D');
INSERT INTO Branches(branch, programme_abbreviation)
VALUES('CSALL', 'D');
INSERT INTO Branches(branch, programme_abbreviation)
VALUES('CSALL', 'IT');
INSERT INTO Branches(branch, programme_abbreviation)
VALUES('MPSOF', 'IT');
INSERT INTO Branches(branch, programme_abbreviation)
VALUES('MPSOF', 'D');
INSERT INTO Branches(branch, programme_abbreviation)
VALUES('RLHK', 'A');
INSERT INTO Branches(branch, programme_abbreviation)
VALUES('Production', 'M');
/* Student */
INSERT INTO Students(student_id, student_name, branch, programme_abbreviation)
VALUES(9303240890, 'Johan Angséus', 'CSN', 'D');
INSERT INTO Students(student_id, student_name, branch, programme_abbreviation)
VALUES(9303240891, 'Johan Persson', 'CSALL', 'IT');
INSERT INTO Students(student_id, student_name, branch, programme_abbreviation)
VALUES(9405334444, 'Jimmy Hedström', 'CSALL', 'D');
INSERT INTO Students(student_id, student_name, branch, programme_abbreviation)
VALUES(9405223344, 'Anna Jansson', 'RLHK', 'A');
INSERT INTO Students(student_id, student_name, branch, programme_abbreviation)
VALUES(9102224455, 'Borat Jansson', 'CSN', 'D');
INSERT INTO Students(student_id, student_name, branch, programme_abbreviation)
VALUES(9102224454, 'Jenny Jansson', 'CSN', 'D');
INSERT INTO Students(student_id, student_name, branch, programme_abbreviation)
VALUES(9102224433, 'Herman Nilsson', 'CSN', 'D');
INSERT INTO Students(student_id, student_name, branch, programme_abbreviation)
VALUES(1234567890, 'Klara Klar', 'CSN', 'D');
INSERT INTO Students(student_id, student_name, branch, programme_abbreviation)
VALUES(1111222244, 'Jimmy Götte', 'CSN', 'D');
/* Course */
INSERT INTO Courses(code, course_name, credit)
VALUES('TDA357', 'Databases', 7.5);
INSERT INTO Courses(code, course_name, credit)
VALUES('DAT290', 'Projektkurs', 4.5);
INSERT INTO Courses(code, course_name, credit)
VALUES('MCA222', 'Maskiner och varuhantering', 7.5);
INSERT INTO Courses(code, course_name, credit)
VALUES('TIF850', 'Fysik', 7.5);
INSERT INTO Courses(code, course_name, credit)
VALUES('EDM250', 'Inledande matematik', 3);
INSERT INTO Courses(code, course_name, credit)
VALUES('TDA222', 'Paralell programmering', 7.5);
INSERT INTO Courses(code, course_name, credit)
VALUES('MKV123', 'Trattkunskap', 2.5);
INSERT INTO Courses(code, course_name, credit)
VALUES('KEK253', 'Kellera', 7.5);
INSERT INTO Courses(code, course_name, credit)
VALUES('TDE123', 'Tjenixen', 7.5);
INSERT INTO Courses(code, course_name, credit)
VALUES('MAT122', 'Matematik för alla', 20);
INSERT INTO Courses(code, course_name, credit)
VALUES('KLA111', 'Klara kan inte vinna', 10);
INSERT INTO Courses(code, course_name, credit)
VALUES('FFF111', 'Full kurs 101', 7);
INSERT INTO Courses(code, course_name, credit)
VALUES('FFF222', 'Full kurs 102', 7);
/* RestrictedCourse */
INSERT INTO RestrictedCourses(code, attendees)
VALUES('TDA357', 10);
INSERT INTO RestrictedCourses(code, attendees)
VALUES('FFF111', 2);
INSERT INTO RestrictedCourses(code, attendees)
VALUES('FFF222', 2);
/* Classification */
INSERT INTO Classifications(classification)
VALUES('Math');
INSERT INTO Classifications(classification)
VALUES('Research');
INSERT INTO Classifications(classification)
VALUES('Seminar');
/* isHosting */
INSERT INTO isHosting(department_abbreviation, programme_abbreviation)
VALUES('CSE', 'D');
INSERT INTO isHosting(department_abbreviation, programme_abbreviation)
VALUES('IT', 'IT');
INSERT INTO isHosting(department_abbreviation, programme_abbreviation)
VALUES('SSY', 'M');
INSERT INTO isHosting(department_abbreviation, programme_abbreviation)
VALUES('CSE', 'A');
/* attendsTo */
INSERT INTO attendsTo(student_id, programme_abbreviation, branch)
VALUES(9303240890, 'D', 'CSN');
INSERT INTO attendsTo(student_id, programme_abbreviation, branch)
VALUES(9303240891, 'IT', 'CSALL');
INSERT INTO attendsTo(student_id, programme_abbreviation, branch)
VALUES(9405334444, 'A', 'RLHK');
INSERT INTO attendsTo(student_id, programme_abbreviation, branch)
VALUES(9405223344, 'M', 'Production');
INSERT INTO attendsTo(student_id, programme_abbreviation, branch)
VALUES(9102224433, 'D', 'CSN');
/* hasCompleted */
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(9303240890, 'TDA357', 'U');
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(9303240891, 'EDM250', '3');
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(9303240890, 'DAT290', '4');
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(9405334444, 'TIF850', '4');
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(9405223344, 'MKV123', '5');
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(9102224455, 'TDA222', '5');
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(9102224454, 'TDA222', '4');
/* Student who completed all courses */
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(1234567890, 'TDA357', '5');
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(1234567890, 'DAT290', '5');
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(1234567890, 'MCA222', '5');
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(1234567890, 'TIF850', '5');
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(1234567890, 'EDM250', '5');
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(1234567890, 'TDA222', '5');
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(1234567890, 'MKV123', '5');
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(1234567890, 'KEK253', '5');
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(1234567890, 'TDE123', '5');
INSERT INTO hasCompleted(student_id, code, grade)
VALUES(1234567890, 'MAT122', '5');
/* hasRegistered */
INSERT INTO hasRegistered(student_id, code)
VALUES(9303240890, 'EDM250');
INSERT INTO hasRegistered(student_id, code)
VALUES(9405334444, 'TDA357');
INSERT INTO hasRegistered(student_id, code)
VALUES(9405223344, 'EDM250');
INSERT INTO hasRegistered(student_id, code)
VALUES(1234567890, 'KLA111');
INSERT INTO hasRegistered(student_id, code)
VALUES(9405223344, 'FFF111');
INSERT INTO hasRegistered(student_id, code)
VALUES(9405334444, 'FFF111');
INSERT INTO hasRegistered(student_id, code)
VALUES(9405223344, 'FFF222');
INSERT INTO hasRegistered(student_id, code)
VALUES(1234567890, 'FFF222');
INSERT INTO hasRegistered(student_id, code)
VALUES(1111222244, 'FFF222');
INSERT INTO hasRegistered(student_id, code)
VALUES(9405334444, 'FFF222');
/* recommendedCourse */
INSERT INTO recommendedCourse(code, programme_abbreviation, branch)
VALUES('TDA357', 'D', 'CSN');
INSERT INTO recommendedCourse(code, programme_abbreviation, branch)
VALUES('TIF850', 'IT', 'CSALL');
INSERT INTO recommendedCourse(code, programme_abbreviation, branch)
VALUES('MKV123', 'M', 'Production');
INSERT INTO recommendedCourse(code, programme_abbreviation, branch)
VALUES('EDM250', 'A', 'RLHK');
/* branchMandatory */
INSERT INTO branchMandatory(code, programme_abbreviation,branch)
VALUES('TDA357', 'D', 'CSN');
INSERT INTO branchMandatory(code, programme_abbreviation,branch)
VALUES('TDA222', 'D', 'CSN');
/* programmeMandatory */
INSERT INTO programmeMandatory(code, programme_abbreviation)
VALUES('MCA222', 'M');
INSERT INTO programmeMandatory(code, programme_abbreviation)
VALUES('TDE123', 'D');
/* belongsTo */
INSERT INTO belongsTo(branch, programme_abbreviation)
VALUES('CSN', 'D');
INSERT INTO belongsTo(branch, programme_abbreviation)
VALUES('CSALL', 'D');
INSERT INTO belongsTo(branch, programme_abbreviation)
VALUES('CSALL', 'IT');
INSERT INTO belongsTo(branch, programme_abbreviation)
VALUES('MPSOF', 'D');
INSERT INTO belongsTo(branch, programme_abbreviation)
VALUES('MPSOF', 'IT');
INSERT INTO belongsTo(branch, programme_abbreviation)
VALUES('RLHK', 'A');
INSERT INTO belongsTo(branch, programme_abbreviation)
VALUES('Production', 'M');
/* isGiven */
INSERT INTO isGiven(code, department_abbreviation)
VALUES('TDA357', 'CSE');
INSERT INTO isGiven(code, department_abbreviation)
VALUES('DAT290', 'CSE');
INSERT INTO isGiven(code, department_abbreviation)
VALUES('TDA222', 'IT');
INSERT INTO isGiven(code, department_abbreviation)
VALUES('TIF850', 'SSY');
/* hasClassifications */
INSERT INTO hasClassifications(code, classification)
VALUES('TIF850', 'Math');
INSERT INTO hasClassifications(code, classification)
VALUES('TDA222', 'Seminar');
INSERT INTO hasClassifications(code, classification)
VALUES('DAT290', 'Research');
INSERT INTO hasClassifications(code, classification)
VALUES('MAT122', 'Math');
INSERT INTO hasClassifications(code, classification)
VALUES('TDA357', 'Research');
/* prerequisites */
INSERT INTO prerequisites(code1, code2)
VALUES('TDA357', 'DAT290');
INSERT INTO prerequisites(code1, code2)
VALUES('MKV123', 'TDA222');
/* isWaiting */
INSERT INTO isWaiting(code, student_id, placeInQueue)
VALUES('TDA357', '9102224455', 1);
INSERT INTO isWaiting(code, student_id, placeInQueue)
VALUES('TDA357', '9102224433', 2);
INSERT INTO isWaiting(code, student_id, placeInQueue)
VALUES('FFF111', '1234567890', 1);/* CourseQueuePostitions */
CREATE OR REPLACE VIEW CourseQueuePositions AS
SELECT *
FROM isWaiting;