-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.sql
94 lines (72 loc) · 1.92 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
-- Active: 1697280133423@@127.0.0.1@3306@school
SHOW DATABASES;
use school;
show TABLES;
create TABLE student(
student_ID INTEGER PRIMARY KEY ,
first_name VARCHAR(50),
last_name VARCHAR(50),
Dataofbirth DATE,
gender SET('M','F')
);
drop Table teachers;
CREATE Table teachers (
TeacherID INTEGER PRIMARY key,
Name VARCHAR(50),
Dataofbirth DATE,
Email VARCHAR(50) NOT NULL,
Passcode VARCHAR(300) NOT NULL,
gender SET('M','F'),
SubjectTaught VARCHAR(30)
);
CREATE Table classes (
classID INTEGER PRIMARY KEY ,
className VARCHAR(10)
);
CREATE TABLE Subjects (
subjectID INTEGER PRIMARY KEY,
subjectName VARCHAR(10)
);
CREATE TABLE attendance (
attendanceID INTEGER PRIMARY KEY,
student_ID INTEGER,
classID INTEGER,
date DATE,
status VARCHAR(10),
FOREIGN KEY (student_ID) REFERENCES student(student_ID),
FOREIGN KEY (classID) REFERENCES classes(classID)
);
SELECT * from student;
CREATE TABLE Exam(
ExamID INTEGER PRIMARY KEY,
student_ID INTEGER,
classID INTEGER,
subjectID INTEGER,
ExamDate DATE
);
-- DROP TABLE student;
CREATE Table users(
user_ID INTEGER PRIMARY KEY,
UserName VARCHAR(100),
Password VARCHAR(100),
userType set('Admin','Teacher','Student')
);
CREATE TABLE Grades(
GradeID INTEGER PRIMARY KEY,
ExamID INTEGER,
student_ID INTEGER,
Grade SET('A','B','C','E','O'),
marks INTEGER,
Foreign Key (ExamID) REFERENCES Exam(ExamID),
Foreign Key (student_ID) REFERENCES student(student_ID)
);
-- CREATE TABLE Enrollments(
-- EnrollmentID INTEGER PRIMARY KEY,
-- studentID INTEGER,
-- classID INTEGER,
-- EnrollmentData
-- )
SHOW TABLES;
DESCRIBE TABLE teachers;
INSERT INTO teachers (TeacherID, first_name, last_name, Dataofbirth, Email, Passcode, gender, SubjectTaught)
VALUES (1232, 'mari', 'selvam', '2023-11-20', '[email protected]', 'u3rfh3893ffr9f', 'M', 'science');