-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.sql
More file actions
40 lines (37 loc) · 861 Bytes
/
Copy pathdatabase.sql
File metadata and controls
40 lines (37 loc) · 861 Bytes
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
drop table subject_timings;
drop table attendance;
drop table student;
drop table teacher;
drop Table login;
create table login(
ID int primary key,
Pass varchar(20) NOT NULL,
acces char(10),
CHECK(acces in ('student','teacher','admin'))
);
create table student(
Name varchar(20) NOT NULL,
RollNo int references login(ID),
PRIMARY KEY(RollNo)
);
create table teacher(
Name varchar(20) NOT NULL,
RollNo int references login(ID),
Subject varchar(20),
PRIMARY KEY(RollNo)
);
create table attendance(
Today date,
c_hour int,
RollNo int,
PRIMARY KEY (Today,c_hour,RollNo),
FOREIGN KEY(RollNo) REFERENCES Student(RollNo)
);
create table subject_timings(
Today date,
c_hour int,
TeacherID int,
strength int,
FOREIGN KEY(TeacherID) REFERENCES Teacher(RollNo)
);
insert into login values(1729,'root','admin');