-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.sql
More file actions
74 lines (65 loc) · 2.02 KB
/
database.sql
File metadata and controls
74 lines (65 loc) · 2.02 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
drop database project;
create database project;
use project;
create table student (
rollno varchar(8) not null primary key,
first_name varchar(20) not null,
last_name varchar(20) not null,
address varchar(100) not null,
phone_no varchar(10) not null,
DOB date not null,
email_id varchar(30) not null,
password varchar(255) not null
);
create table faculty (
id varchar(10) not null primary key,
first_name varchar(20) not null,
last_name varchar(20) not null,
email_id varchar(30) not null,
phone_no varchar(10) not null,
password varchar(255) not null
);
create table Department (
id varchar(10) not null primary key,
name varchar(50) not null
);
create table Program (
id varchar(10) not null primary key,
name varchar(50) not null
);
create table Course (
id varchar(10) not null primary key,
name varchar(50) not null,
description varchar(255) not null,
semester int not null,
program_id varchar(10) not null,
department_id varchar(10) not null,
foreign key (program_id) references Program(id),
foreign key (department_id) references Department(id)
);
create table CourseDocuments (
id int not null primary key auto_increment,
name varchar(30) not null,
path varchar(100) not null,
course_id varchar(10) not null,
foreign key (course_id) references Course(id)
);
create table Course_Student (
course_id varchar(10) not null,
student_id varchar(10) not null,
foreign key (student_id) references student(rollNo) ON DELETE CASCADE,
foreign key (course_id) references Course(id),
primary key (course_id,student_id)
);
create table Teacher_Course (
course_id varchar(10) not null,
faculty_id varchar(10) not null,
foreign key (course_id) references Course(id),
foreign key (faculty_id) references faculty(id)
);
create table messages (
message_id int primary key auto_increment,
message text not null,
course_id varchar(10) not null,
foreign key (course_id) references Course(id)
);