-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathqueries.txt
97 lines (88 loc) · 2.5 KB
/
queries.txt
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
CREATE TABLE users(
id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
name varchar(255),
email varchar(255),
password varchar(255),
role varchar(255)
);
CREATE TABLE sections(
id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
name varchar(255),
semester varchar(255)
);
CREATE TABLE type(
id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
name varchar(255),
status int
);
CREATE TABLE courses(
id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
name varchar(255),
code varchar(255),
credit varchar(255),
type varchar(255),
semester int
);
CREATE TABLE sessions(
id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
name varchar(255),
status int
);
CREATE TABLE teacher_assign(
id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
teacher_id int,
section_id int,
course_id int,
session_id int,
status int,
FOREIGN KEY (teacher_id) REFERENCES users(id),
FOREIGN KEY (section_id) REFERENCES sections(id),
FOREIGN KEY (course_id) REFERENCES courses(id),
FOREIGN KEY (session_id) REFERENCES sessions(id)
);
CREATE TABLE num_dist(
id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
course_id int,
teacher_id int,
section_id int,
session_id int,
catagory_name varchar(255),
marks int,
FOREIGN KEY (teacher_id) REFERENCES users(id),
FOREIGN KEY (course_id) REFERENCES courses(id),
FOREIGN KEY (section_id) REFERENCES sections(id),
FOREIGN KEY (session_id) REFERENCES sessions(id)
);
CREATE TABLE enrollment(
id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
student_id int,
course_id int,
type_id int,
section_id int,
teacher_id int,
session_id int,
status int,
FOREIGN KEY (student_id) REFERENCES users(id),
FOREIGN KEY (teacher_id) REFERENCES users(id),
FOREIGN KEY (course_id) REFERENCES courses(id),
FOREIGN KEY (section_id) REFERENCES sections(id),
FOREIGN KEY (session_id) REFERENCES sessions(id),
FOREIGN KEY (course_type_id) REFERENCES type(id)
);
// unused table
CREATE TABLE marks_assign(
id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
student_id int,
teacher_id int,
course_id int,
section_id int,
session_id int,
dist_id int,
marks int,
FOREIGN KEY (teacher_id) REFERENCES users(id),
FOREIGN KEY (session_id) REFERENCES sessions(id),
FOREIGN KEY (student_id) REFERENCES users(id),
FOREIGN KEY (course_id) REFERENCES courses(id),
FOREIGN KEY (section_id) REFERENCES sections(id),
FOREIGN KEY (dist_id) REFERENCES num_dist(id)
);