PRAGMA foreign_keys = ON;

PRAGMA writable_schema = 1;
DELETE FROM sqlite_master WHERE type IN ("table", "index", "trigger");
PRAGMA writable_schema = 0;
VACUUM;

CREATE TABLE "Degree_Programs" (
"degree_program_id" INT UNIQUE,
"department_id" INT,
"degree_summary_name" VARCHAR(255),
PRIMARY KEY ("degree_program_id"),
FOREIGN KEY ("department_id") REFERENCES "Departments"("department_id")
);

CREATE TABLE "Departments" (
"department_id" INT,
"department_name" VARCHAR(255),
PRIMARY KEY ("department_id")
);

CREATE TABLE "Student_Enrolment" (
"student_enrolment_id" INT,
"degree_program_id" INT,
"semester_id" INT,
"student_id" INT,
PRIMARY KEY ("student_enrolment_id"),
FOREIGN KEY ("student_id") REFERENCES "Students"("student_id"),
FOREIGN KEY ("degree_program_id") REFERENCES "Degree_Programs"("degree_program_id")
);

CREATE TABLE "Students" (
"student_id" INT UNIQUE,
PRIMARY KEY ("student_id")
);





INSERT INTO "Departments" VALUES ("1", "Computer Science");
INSERT INTO "Departments" VALUES ("2", "Mathematics");
INSERT INTO "Departments" VALUES ("3", "Physics");
INSERT INTO "Departments" VALUES ("4", "History");
INSERT INTO "Degree_Programs" VALUES ("101", "1", "BSc Computer Science");
INSERT INTO "Degree_Programs" VALUES ("102", "1", "MSc Computer Science");
INSERT INTO "Degree_Programs" VALUES ("201", "2", "BSc Mathematics");
INSERT INTO "Degree_Programs" VALUES ("202", "2", "MSc Mathematics");
INSERT INTO "Degree_Programs" VALUES ("301", "3", "BSc Physics");
INSERT INTO "Degree_Programs" VALUES ("302", "3", "MSc Physics");
INSERT INTO "Degree_Programs" VALUES ("401", "4", "BA History");
INSERT INTO "Students" VALUES ("1001");
INSERT INTO "Students" VALUES ("1002");
INSERT INTO "Students" VALUES ("1003");
INSERT INTO "Students" VALUES ("1004");
INSERT INTO "Students" VALUES ("1005");
INSERT INTO "Students" VALUES ("1006");
INSERT INTO "Students" VALUES ("1007");
INSERT INTO "Students" VALUES ("1008");
INSERT INTO "Students" VALUES ("1009");
INSERT INTO "Students" VALUES ("1010");
INSERT INTO "Students" VALUES ("1011");
INSERT INTO "Students" VALUES ("1012");
INSERT INTO "Students" VALUES ("1013");
INSERT INTO "Students" VALUES ("1014");
INSERT INTO "Students" VALUES ("1015");
INSERT INTO "Students" VALUES ("1016");
INSERT INTO "Students" VALUES ("1017");
INSERT INTO "Students" VALUES ("1018");
INSERT INTO "Students" VALUES ("1019");
INSERT INTO "Students" VALUES ("1020");
INSERT INTO "Student_Enrolment" VALUES ("1", "101", "1", "1001");
INSERT INTO "Student_Enrolment" VALUES ("2", "101", "1", "1002");
INSERT INTO "Student_Enrolment" VALUES ("3", "101", "1", "1003");
INSERT INTO "Student_Enrolment" VALUES ("4", "101", "2", "1004");
INSERT INTO "Student_Enrolment" VALUES ("5", "101", "2", "1005");
INSERT INTO "Student_Enrolment" VALUES ("6", "201", "1", "1006");
INSERT INTO "Student_Enrolment" VALUES ("7", "201", "1", "1007");
INSERT INTO "Student_Enrolment" VALUES ("8", "201", "2", "1008");
INSERT INTO "Student_Enrolment" VALUES ("9", "202", "1", "1009");
INSERT INTO "Student_Enrolment" VALUES ("10", "301", "1", "1010");
INSERT INTO "Student_Enrolment" VALUES ("11", "301", "2", "1011");
INSERT INTO "Student_Enrolment" VALUES ("12", "302", "1", "1012");
INSERT INTO "Student_Enrolment" VALUES ("13", "401", "1", "1013");
INSERT INTO "Student_Enrolment" VALUES ("14", "401", "1", "1014");
INSERT INTO "Student_Enrolment" VALUES ("15", "401", "2", "1015");
INSERT INTO "Student_Enrolment" VALUES ("16", "401", "2", "1016");
INSERT INTO "Student_Enrolment" VALUES ("17", "401", "2", "1017");
INSERT INTO "Student_Enrolment" VALUES ("18", "101", "2", "1018");
INSERT INTO "Student_Enrolment" VALUES ("19", "101", "2", "1019");
INSERT INTO "Student_Enrolment" VALUES ("20", "101", "2", "1020");