-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema_sqlite.sql
54 lines (42 loc) · 1.29 KB
/
schema_sqlite.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
-- lecturers definition
CREATE TABLE "lecturers" (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
nidn INTEGER NOT NULL,
name TEXT NOT NULL,
major TEXT NOT NULL,
faculty TEXT NOT NULL
);
CREATE UNIQUE INDEX lecturer_nidn_IDX ON "lecturers" (nidn);
-- students definition
CREATE TABLE students (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
faculty TEXT NOT NULL,
major TEXT NOT NULL,
generation INTEGER NOT NULL,
gpa INTEGER NOT NULL,
status TEXT NOT NULL,
graduation_year INTEGER,
graduation_semester INTEGER
);
-- lecturer_researches definition
CREATE TABLE "lecturer_researches" (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
nidn INTEGER NOT NULL,
title TEXT NOT NULL,
publication_date TEXT NOT NULL,
publication_type TEXT NOT NULL,
publication_detail TEXT NOT NULL,
CONSTRAINT lecturer_research_lecturer_FK FOREIGN KEY (nidn) REFERENCES "lecturers"(id)
);
CREATE INDEX lecturer_research_nidn_IDX ON "lecturer_researches" (nidn);
-- student_activities definition
CREATE TABLE student_activities (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
student_id INTEGER NOT NULL,
bank_id INTEGER NOT NULL,
name TEXT NOT NULL,
"type" TEXT NOT NULL,
date TEXT NOT NULL,
CONSTRAINT student_activities_students_FK FOREIGN KEY (student_id) REFERENCES students(id)
);