-
Notifications
You must be signed in to change notification settings - Fork 2
/
db.sql
110 lines (99 loc) · 3.95 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
-- Create teachers table
CREATE TABLE teachers (
username VARCHAR(50) PRIMARY KEY,
teacher_name varchar(20),
password VARCHAR(50),
email varchar(20),
phone varchar(10)
);
-- Insert dummy data into teachers table
INSERT INTO teachers (username, teacher_name,password,email,phone)
VALUES
('teacher1','Jenny','password1','[email protected]','9183885580'),
('teacher2','Mary','password2','[email protected]','9801802223');
-- Create admins table
CREATE TABLE admins (
username VARCHAR(50) PRIMARY KEY,
admin_name varchar(20),
password VARCHAR(50),
email varchar(20),
phone varchar(10)
);
-- Insert dummy data into admins table
INSERT INTO admins (username, admin_name,password,email,phone)
VALUES
('admin1','Will Smith','password1','[email protected]','9550634682'),
('admin2','John Wick', 'password2','[email protected]','8192083447');
-- Create classes table
CREATE TABLE classes (
class_id INT PRIMARY KEY AUTO_INCREMENT,
class_name VARCHAR(50),
teacher_username VARCHAR(50),
class_sec VARCHAR(10),
FOREIGN KEY (teacher_username) REFERENCES teachers(username)
);
-- Create classes table
CREATE TABLE classes (
class_id INT PRIMARY KEY AUTO_INCREMENT,
class_name VARCHAR(50),
teacher_username VARCHAR(50),
class_date date,
class_sec VARCHAR(10),
FOREIGN KEY (teacher_username) REFERENCES teachers(username)
);
-- Insert dummy data into classes table
INSERT INTO classes (class_id, class_name, teacher_username, class_date,class_sec)
VALUES
(1,'Machine Learning','teacher1','2023-05-31',,'CSE1'),
(2,'BCT', 'teacher2','2023-05-31','CSE2'),
(3,'CPNM','teacher1','2023-05-30','CSE2'),
(4,'Statistics','teacher1','2023-06-01','CSE2'),
(5,'Algorithms','teacher2','2023-05-30','CSE1'),
(6,'DS','teacher2','2023-06-01','CSE1');
-- Create students table
CREATE TABLE students (
student_id INT PRIMARY KEY ,
student_name VARCHAR(50),
email varchar(20),
class_sec VARCHAR(10),
phone varchar(10)
);
-- Insert dummy data into students table
INSERT INTO students (student_id,student_name, email,class_sec,phone)
VALUES
(1,'John Doe','[email protected]','CSE1','8866443210' ),
(2,'Jane Smith','[email protected]','CSE1','9313302392'),
(3,'Mark Johnson','[email protected]','CSE2','9314123452' ),
(4,'Emily Davis','[email protected]','CSE2','9233351521'),
(5,'Jacob White','[email protected]','CSE1','6059073030'),
(6,'Shaun Simpson','[email protected]','CSE1','896-060-15'),
(7,'Tyler Hodge','[email protected]','CSE1','836-921-13'),
(8,'Steven Reid','[email protected]','CSE1','3841459133'),
(9,'Sheila Jones','[email protected]','CSE1','240-938-36'),
(10,'Courtney Richards','[email protected]','CSE1','209-582-42'),
(11,'Angela Williams','[email protected]','CSE1','(931)552-5'),
(12,'Taylor Jackson','[email protected]','CSE1','(242)991-2'),
(13,'Joshua Morris','[email protected]','CSE2','(313)267-3'),
(14,'Jasmin Parker','[email protected]','CSE2','(509)934-1'),
(15,'Marc Chang','[email protected]','CSE2','(555)978-8'),
(16,'Kimberly Haynes','[email protected]','CSE2','139.554.92'),
(17,'Dr. Robert Jacobson','[email protected]','CSE2','5538343275'),
(18,'Anthony Miller','[email protected]','CSE2','117.760.40'),
(19,'Laura Stewart','[email protected]','CSE2','749-718-11'),
(20,'Jacqueline York','[email protected]','CSE2','001-348-79');
-- Create attendance table
CREATE TABLE attendance (
id INT PRIMARY KEY AUTO_INCREMENT,
class_id INT,
student_id INT,
status ENUM('present', 'absent'),
FOREIGN KEY (class_id) REFERENCES classes(class_id),
FOREIGN KEY (student_id) REFERENCES students(student_id)
);
-- Insert dummy data into attendance table
INSERT INTO attendance (id,class_id, student_id, status)
VALUES
(1, 1, 1, 'present'),
(2, 1, 2, 'absent'),
(3, 2, 3, 'present'),
(4, 2, 4, 'absent');