-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.sql
41 lines (36 loc) · 875 Bytes
/
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
CREATE TABLE users (
user_id SERIAL PRIMARY KEY,
username VARCHAR(255) NOT NULL,
email VARCHAR(255),
password VARCHAR(255) NOT NULL
);
CREATE TABLE tasks (
user_id INT,
task_id SERIAL PRIMARY KEY,
sub TEXT,
des TEXT,
FOREIGN KEY (user_id) REFERENCES users(user_id)
);
CREATE TABLE subjects (
user_id INT,
sub VARCHAR(255) NOT NULL PRIMARY KEY,
FOREIGN KEY (user_id) REFERENCES users(user_id)
);
CREATE TABLE exams (
sub VARCHAR(255),
exam_name TEXT,
max_marks INT,
scored INT,
FOREIGN KEY (sub) REFERENCES subjects(sub)
);
CREATE TABLE attendance (
user_id INT,
sub_att VARCHAR(255) PRIMARY KEY,
FOREIGN KEY (user_id) REFERENCES users(user_id)
);
CREATE TABLE att (
sub_att VARCHAR(255),
attended INT,
tot_classes INT,
FOREIGN KEY (sub_att) REFERENCES attendance(sub_att)
);