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,
"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,
"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 UNIQUE,
"first_name" VARCHAR(80),
"middle_name" VARCHAR(40),
"last_name" VARCHAR(40),
PRIMARY KEY ("student_id")
);





INSERT INTO "Degree_Programs" VALUES ("1", "Bachelor of Science in Computer Science");
INSERT INTO "Degree_Programs" VALUES ("2", "Master of Arts in History");
INSERT INTO "Degree_Programs" VALUES ("3", "Bachelor of Arts in English Literature");
INSERT INTO "Degree_Programs" VALUES ("4", "PhD in Physics");
INSERT INTO "Degree_Programs" VALUES ("5", "Bachelor of Business Administration");
INSERT INTO "Degree_Programs" VALUES ("6", "Associate of Science in Nursing");
INSERT INTO "Degree_Programs" VALUES ("7", "Bachelor of Fine Arts in Painting");
INSERT INTO "Degree_Programs" VALUES ("8", "Master of Science in Data Science");
INSERT INTO "Degree_Programs" VALUES ("9", "Bachelor of Engineering in Electrical Engineering");
INSERT INTO "Degree_Programs" VALUES ("10", "Bachelor of Science in Biology");
INSERT INTO "Departments" VALUES ("1", "Computer Science");
INSERT INTO "Departments" VALUES ("2", "History");
INSERT INTO "Departments" VALUES ("3", "English");
INSERT INTO "Departments" VALUES ("4", "Physics");
INSERT INTO "Departments" VALUES ("5", "Business");
INSERT INTO "Departments" VALUES ("6", "Nursing");
INSERT INTO "Departments" VALUES ("7", "Fine Arts");
INSERT INTO "Departments" VALUES ("8", "Mathematics");
INSERT INTO "Departments" VALUES ("9", "Engineering");
INSERT INTO "Departments" VALUES ("10", "Biology");
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 ("101", "Alice", "M", "Smith");
INSERT INTO "Students" VALUES ("102", "Bob", "J", "Johnson");
INSERT INTO "Students" VALUES ("103", "Charlie", "NULL", "Brown");
INSERT INTO "Students" VALUES ("104", "Diana", "L", "Prince");
INSERT INTO "Students" VALUES ("105", "Eve", "A", "Adams");
INSERT INTO "Students" VALUES ("106", "Frank", "P", "Miller");
INSERT INTO "Students" VALUES ("107", "Grace", "NULL", "Davis");
INSERT INTO "Students" VALUES ("108", "Henry", "K", "Wilson");
INSERT INTO "Students" VALUES ("109", "Ivy", "R", "Moore");
INSERT INTO "Students" VALUES ("110", "Jack", "S", "Taylor");
INSERT INTO "Students" VALUES ("111", "Karen", "B", "White");
INSERT INTO "Students" VALUES ("112", "Liam", "C", "Harris");
INSERT INTO "Student_Enrolment" VALUES ("1", "1", "1", "101");
INSERT INTO "Student_Enrolment" VALUES ("2", "3", "1", "102");
INSERT INTO "Student_Enrolment" VALUES ("3", "2", "2", "103");
INSERT INTO "Student_Enrolment" VALUES ("4", "1", "2", "104");
INSERT INTO "Student_Enrolment" VALUES ("5", "5", "1", "105");
INSERT INTO "Student_Enrolment" VALUES ("6", "4", "3", "106");
INSERT INTO "Student_Enrolment" VALUES ("7", "3", "2", "107");
INSERT INTO "Student_Enrolment" VALUES ("8", "7", "1", "108");
INSERT INTO "Student_Enrolment" VALUES ("9", "9", "2", "109");
INSERT INTO "Student_Enrolment" VALUES ("10", "10", "1", "110");
INSERT INTO "Student_Enrolment" VALUES ("11", "1", "3", "111");
INSERT INTO "Student_Enrolment" VALUES ("12", "2", "4", "112");
INSERT INTO "Student_Enrolment" VALUES ("13", "5", "2", "101");
INSERT INTO "Student_Enrolment" VALUES ("14", "1", "4", "102");
INSERT INTO "Student_Enrolment" VALUES ("15", "3", "3", "105");
INSERT INTO "Student_Enrolment" VALUES ("16", "6", "1", "103");
INSERT INTO "Student_Enrolment" VALUES ("17", "8", "2", "104");
INSERT INTO "Student_Enrolment" VALUES ("18", "10", "3", "106");
INSERT INTO "Student_Enrolment" VALUES ("19", "7", "2", "111");
INSERT INTO "Student_Enrolment" VALUES ("20", "9", "1", "112");