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,
"semester_name" VARCHAR(255),
PRIMARY KEY ("semester_id")
);

CREATE TABLE "Student_Enrolment" (
"student_enrolment_id" INT,
"degree_program_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,
"first_name" VARCHAR(80),
"middle_name" VARCHAR(40),
"last_name" VARCHAR(40),
PRIMARY KEY ("student_id")
);





INSERT INTO "Courses" VALUES ("1", "Introduction to Computer Science");
INSERT INTO "Courses" VALUES ("2", "Advanced Mathematics");
INSERT INTO "Courses" VALUES ("3", "English Literature");
INSERT INTO "Courses" VALUES ("4", "Physics");
INSERT INTO "Courses" VALUES ("5", "Philosophy");
INSERT INTO "Degree_Programs" VALUES ("1", "Bachelor of Science");
INSERT INTO "Degree_Programs" VALUES ("2", "Master of Arts");
INSERT INTO "Degree_Programs" VALUES ("3", "Bachelor of Arts");
INSERT INTO "Degree_Programs" VALUES ("4", "Doctorate in Physics");
INSERT INTO "Degree_Programs" VALUES ("5", "Associate Degree in Business");
INSERT INTO "Departments" VALUES ("1", "Computer Science");
INSERT INTO "Departments" VALUES ("2", "Mathematics");
INSERT INTO "Departments" VALUES ("3", "English");
INSERT INTO "Departments" VALUES ("4", "Physics");
INSERT INTO "Departments" VALUES ("5", "Philosophy");
INSERT INTO "Semesters" VALUES ("1", "Fall 2023");
INSERT INTO "Semesters" VALUES ("2", "Spring 2024");
INSERT INTO "Semesters" VALUES ("3", "Summer 2024");
INSERT INTO "Students" VALUES ("101", "Alice", "Marie", "Johnson");
INSERT INTO "Students" VALUES ("102", "Bob", "Lee", "Smith");
INSERT INTO "Students" VALUES ("103", "Charlie", "Ann", "Brown");
INSERT INTO "Students" VALUES ("104", "Diana", "Louise", "Miller");
INSERT INTO "Students" VALUES ("105", "Ethan", "James", "Davis");
INSERT INTO "Students" VALUES ("106", "Fiona", "Grace", "Wilson");
INSERT INTO "Students" VALUES ("107", "George", "Michael", "Moore");
INSERT INTO "Students" VALUES ("108", "Hannah", "Rose", "Taylor");
INSERT INTO "Student_Enrolment" VALUES ("201", "1", "101");
INSERT INTO "Student_Enrolment" VALUES ("202", "3", "102");
INSERT INTO "Student_Enrolment" VALUES ("203", "2", "103");
INSERT INTO "Student_Enrolment" VALUES ("204", "1", "104");
INSERT INTO "Student_Enrolment" VALUES ("205", "4", "105");
INSERT INTO "Student_Enrolment" VALUES ("206", "3", "106");
INSERT INTO "Student_Enrolment" VALUES ("207", "5", "107");
INSERT INTO "Student_Enrolment" VALUES ("208", "1", "108");