-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
29 lines (27 loc) · 826 Bytes
/
schema.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
CREATE TABLE lecturers (
id int AUTO_INCREMENT PRIMARY KEY,
name varchar(255) NOT NULL,
added datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE semesters (
id int AUTO_INCREMENT PRIMARY KEY,
name varchar(255) NOT NULL
);
CREATE TABLE classes (
id int AUTO_INCREMENT PRIMARY KEY,
name varchar(255) NOT NULL,
added datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
semester_id int NOT NULL,
FOREIGN KEY (semester_id) REFERENCES semesters(id)
);
CREATE TABLE lecture_trivial_count (
id int AUTO_INCREMENT PRIMARY KEY,
added datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
lecture_time datetime NOT NULL,
lecturer_id int NOT NULL,
class_id int NOT NULL,
trivial_count int NOT NULL,
duration time NOT NULL,
FOREIGN KEY (lecturer_id) REFERENCES lecturers(id),
FOREIGN KEY (class_id) REFERENCES classes(id)
);