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,
"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),
"email_address" 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 Literature");
INSERT INTO "Degree_Programs" VALUES ("3", "Bachelor of Arts in History");
INSERT INTO "Degree_Programs" VALUES ("4", "PhD in Physics");
INSERT INTO "Degree_Programs" VALUES ("5", "Bachelor of Engineering in Electrical Engineering");
INSERT INTO "Degree_Programs" VALUES ("6", "Associate of Science in Business");
INSERT INTO "Degree_Programs" VALUES ("7", "Bachelor of Fine Arts in Graphic Design");
INSERT INTO "Degree_Programs" VALUES ("8", "Master of Science in Data Science");
INSERT INTO "Departments" VALUES ("101", "Computer Science");
INSERT INTO "Departments" VALUES ("102", "Literature");
INSERT INTO "Departments" VALUES ("103", "History");
INSERT INTO "Departments" VALUES ("104", "Physics");
INSERT INTO "Departments" VALUES ("105", "Electrical Engineering");
INSERT INTO "Departments" VALUES ("106", "Business Administration");
INSERT INTO "Departments" VALUES ("107", "Fine Arts");
INSERT INTO "Semesters" VALUES ("20231", "Fall 2023");
INSERT INTO "Semesters" VALUES ("20241", "Spring 2024");
INSERT INTO "Semesters" VALUES ("20242", "Summer 2024");
INSERT INTO "Semesters" VALUES ("20243", "Fall 2024");
INSERT INTO "Students" VALUES ("1001", "Alice", "M", "Smith", "alice.smith@example.com");
INSERT INTO "Students" VALUES ("1002", "Bob", "J", "Johnson", "bob.j@example.com");
INSERT INTO "Students" VALUES ("1003", "Charlie", "NULL", "Brown", "charlie.b@example.com");
INSERT INTO "Students" VALUES ("1004", "Diana", "L", "Prince", "diana.p@example.com");
INSERT INTO "Students" VALUES ("1005", "Eve", "K", "Davis", "eve.d@example.com");
INSERT INTO "Students" VALUES ("1006", "Frank", "NULL", "Miller", "frank.m@example.com");
INSERT INTO "Students" VALUES ("1007", "Grace", "A", "Taylor", "grace.t@example.com");
INSERT INTO "Students" VALUES ("1008", "Henry", "P", "Wilson", "henry.w@example.com");
INSERT INTO "Student_Enrolment" VALUES ("1", "1", "1001");
INSERT INTO "Student_Enrolment" VALUES ("2", "3", "1002");
INSERT INTO "Student_Enrolment" VALUES ("3", "2", "1003");
INSERT INTO "Student_Enrolment" VALUES ("4", "5", "1004");
INSERT INTO "Student_Enrolment" VALUES ("5", "4", "1005");
INSERT INTO "Student_Enrolment" VALUES ("6", "1", "1006");
INSERT INTO "Student_Enrolment" VALUES ("7", "7", "1007");
INSERT INTO "Student_Enrolment" VALUES ("8", "8", "1008");
INSERT INTO "Student_Enrolment" VALUES ("9", "3", "1001");
INSERT INTO "Student_Enrolment" VALUES ("10", "6", "1003");