-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoneClick-schema.sql
More file actions
53 lines (43 loc) · 1.43 KB
/
oneClick-schema.sql
File metadata and controls
53 lines (43 loc) · 1.43 KB
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
drop database if exists oneClick;
create database oneClick;
USE oneClick;
drop table if exists Instructor;
create table Instructor(
InstructorID int NOT NULL auto_increment,
IDPass varchar(20) NOT NULL,
FirstName varchar(20) NOT NULL,
LastName varchar(20),
primary key(InstructorID));
drop table if exists Student;
create table Student(
StudentID int NOT NULL auto_increment,
IDPass varchar(20) NOT NULL,
FirstName varchar(20) NOT NULL,
LastName varchar(20),
photoLocation text,
primary key(StudentID));
drop table if exists Course;
create table Course(
CourseID varchar(10) unique,
CourseName varchar(40),
semester varchar(10),
primary key(CourseID));
drop table if exists Instructor_courses;
create table Instructor_courses(
CourseID varchar(10),
InstructorID int,
no_of_enrolled_students int,
primary key(CourseID,InstructorID),
foreign key (CourseID) references Course(CourseID) on delete cascade ,
foreign key (InstructorID) references Instructor(InstructorID) on delete cascade );
drop table if exists Student_Attendance;
create table Student_Attendance(
CourseID varchar(10),
StudentID int,
InstructorID int,
dateTaken TIMESTAMP,
attendanceStatus int,
primary key(CourseID,InstructorID),
foreign key (CourseID) references Course(CourseID) on delete cascade ,
foreign key (StudentID) references Student(StudentID) on delete cascade ,
foreign key (InstructorID) references Instructor(InstructorID) on delete cascade );