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 "Courses" (
"course_id" INT,
"course_name" VARCHAR(255),
PRIMARY KEY ("course_id")
);

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

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

CREATE TABLE "Semesters" (
"semester_id" INT UNIQUE,
"semester_name" VARCHAR(255),
PRIMARY KEY ("semester_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 ("semester_id") REFERENCES "Semesters"("semester_id"),
FOREIGN KEY ("degree_program_id") REFERENCES "Degree_Programs"("degree_program_id")
);

CREATE TABLE "Students" (
"student_id" INT,
"first_name" VARCHAR(80),
PRIMARY KEY ("student_id")
);





INSERT INTO "Courses" VALUES ("1", "Introduction to Programming");
INSERT INTO "Courses" VALUES ("2", "Database Systems");
INSERT INTO "Courses" VALUES ("3", "Advanced Algorithms");
INSERT INTO "Courses" VALUES ("4", "Machine Learning");
INSERT INTO "Courses" VALUES ("5", "Data Structures");
INSERT INTO "Degree_Programs" VALUES ("1", "Bachelor of Science in Computer Science");
INSERT INTO "Degree_Programs" VALUES ("2", "Master of Science in Computer Science");
INSERT INTO "Degree_Programs" VALUES ("3", "Bachelor of Arts in English");
INSERT INTO "Degree_Programs" VALUES ("4", "Master of Arts in English");
INSERT INTO "Degree_Programs" VALUES ("5", "PhD in Computer Science");
INSERT INTO "Departments" VALUES ("1", "Computer Science");
INSERT INTO "Departments" VALUES ("2", "English");
INSERT INTO "Departments" VALUES ("3", "Mathematics");
INSERT INTO "Departments" VALUES ("4", "Physics");
INSERT INTO "Departments" VALUES ("5", "Chemistry");
INSERT INTO "Semesters" VALUES ("1", "Fall 2022");
INSERT INTO "Semesters" VALUES ("2", "Spring 2023");
INSERT INTO "Semesters" VALUES ("3", "Summer 2023");
INSERT INTO "Semesters" VALUES ("4", "Fall 2023");
INSERT INTO "Semesters" VALUES ("5", "Spring 2024");
INSERT INTO "Students" VALUES ("1", "Alice");
INSERT INTO "Students" VALUES ("2", "Bob");
INSERT INTO "Students" VALUES ("3", "Charlie");
INSERT INTO "Students" VALUES ("4", "David");
INSERT INTO "Students" VALUES ("5", "Eve");
INSERT INTO "Students" VALUES ("6", "Frank");
INSERT INTO "Students" VALUES ("7", "Grace");
INSERT INTO "Students" VALUES ("8", "Heidi");
INSERT INTO "Student_Enrolment" VALUES ("1", "1", "1", "1");
INSERT INTO "Student_Enrolment" VALUES ("2", "2", "1", "2");
INSERT INTO "Student_Enrolment" VALUES ("3", "1", "2", "3");
INSERT INTO "Student_Enrolment" VALUES ("4", "2", "2", "4");
INSERT INTO "Student_Enrolment" VALUES ("5", "1", "3", "5");
INSERT INTO "Student_Enrolment" VALUES ("6", "2", "3", "6");
INSERT INTO "Student_Enrolment" VALUES ("7", "1", "4", "7");
INSERT INTO "Student_Enrolment" VALUES ("8", "2", "4", "8");
INSERT INTO "Student_Enrolment" VALUES ("9", "3", "1", "1");
INSERT INTO "Student_Enrolment" VALUES ("10", "4", "1", "2");
INSERT INTO "Student_Enrolment" VALUES ("11", "1", "5", "1");
INSERT INTO "Student_Enrolment" VALUES ("12", "2", "5", "2");
INSERT INTO "Student_Enrolment" VALUES ("13", "3", "2", "5");
INSERT INTO "Student_Enrolment" VALUES ("14", "4", "2", "6");
INSERT INTO "Student_Enrolment" VALUES ("15", "1", "1", "3");
INSERT INTO "Student_Enrolment" VALUES ("16", "2", "1", "4");