-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.sql
61 lines (56 loc) · 1.52 KB
/
database.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
CREATE DATABASE PFE;
CREATE TABLE Teacher(
teacher_id INT NOT NULL AUTO_INCREMENT,
fname VARCHAR(255) NOT NULL,
lname VARCHAR(255) NOT NULL,
phoneNum VARCHAR(255) NOT NULL,
type_of_payment VARCHAR(255) NOT NULL DEFAULT 0,
salary INT DEFAULT 0,
PRIMARY KEY (teacher_id),
)
CREATE TABLE Class(
class_id INT NOT NULL AUTO_INCREMENT,
class_name VARCHAR(255) NOT NULL,
duration INT NOT NULL,
classroom INT DEFAULT 0,
price INT DEFAULT 0,
teacher_id INT NOT NULL,
PRIMARY KEY (class_id),
FOREIGN KEY (teacher_id) REFERENCES Teacher (teacher_id)
)
CREATE TABLE Student(
student_id INT NOT NULL AUTO_INCREMENT,
fname VARCHAR(255) NOT NULL,
lname VARCHAR(255) NOT NULL,
bDate DATE NOT NULL,
level INT,
phoneNum VARCHAR(255),
parentNum VARCHAR(255),
enrolment_date DATE NOT NULL,
last_payment_date DATE NOT NULL,
last_payed_month INT NOT NULL,
class_id INT NOT NULL,
PRIMARY KEY (student_id),
FOREIGN KEY (class_id) REFERENCES Class(class_id)
)
CREATE TABLE Schedule(
id INT NOT NULL AUTO_INCREMENT,
day INT NOT NULL,
hour INT NOT NULL,
class_id INT NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (class_id) REFERENCES Class(class_id)
)
CREATE TABLE Request(
request_id INT NOT NULL AUTO_INCREMENT,
fname VARCHAR(255) NOT NULL,
lname VARCHAR(255) NOT NULL,
bDate DATE NOT NULL,
phoneNumber VARCHAR(255) DEFAULT "",
parentNumber VARCHAR(255) DEFAULT "",
level INT NOT NULL,
type INT NOT NULL,
class_name VARCHAR(255) NOT NULL,
request_date DATE NOT NULL,
PRIMARY KEY (request_id),
)