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 "Addresses" (
"address_id" INT,
"city" VARCHAR(255),
PRIMARY KEY ("address_id")
);

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

CREATE TABLE "Student_Enrolment_Courses" (
"student_course_id" INT,
"course_id" INT,
PRIMARY KEY ("student_course_id"),
FOREIGN KEY ("course_id") REFERENCES "Courses"("course_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 "Addresses" VALUES ("1", "New York");
INSERT INTO "Addresses" VALUES ("2", "Los Angeles");
INSERT INTO "Addresses" VALUES ("3", "Chicago");
INSERT INTO "Addresses" VALUES ("4", "Houston");
INSERT INTO "Addresses" VALUES ("5", "Phoenix");
INSERT INTO "Courses" VALUES ("101", "Calculus I");
INSERT INTO "Courses" VALUES ("102", "Linear Algebra");
INSERT INTO "Courses" VALUES ("103", "Introduction to Programming");
INSERT INTO "Courses" VALUES ("104", "Data Structures");
INSERT INTO "Courses" VALUES ("105", "Operating Systems");
INSERT INTO "Courses" VALUES ("106", "Database Management");
INSERT INTO "Courses" VALUES ("107", "Web Development");
INSERT INTO "Students" VALUES ("1", "Alice", "M.", "Smith");
INSERT INTO "Students" VALUES ("2", "Bob", "J.", "Johnson");
INSERT INTO "Students" VALUES ("3", "Charlie", "A.", "Brown");
INSERT INTO "Students" VALUES ("4", "Diana", "L.", "Davis");
INSERT INTO "Students" VALUES ("5", "Eve", "P.", "Miller");
INSERT INTO "Students" VALUES ("6", "Frank", "R.", "Wilson");
INSERT INTO "Students" VALUES ("7", "Grace", "S.", "Moore");
INSERT INTO "Student_Enrolment" VALUES ("1", "10", "1", "1");
INSERT INTO "Student_Enrolment" VALUES ("2", "11", "1", "1");
INSERT INTO "Student_Enrolment" VALUES ("3", "10", "2", "1");
INSERT INTO "Student_Enrolment" VALUES ("4", "12", "1", "2");
INSERT INTO "Student_Enrolment" VALUES ("5", "13", "1", "2");
INSERT INTO "Student_Enrolment" VALUES ("6", "10", "1", "3");
INSERT INTO "Student_Enrolment" VALUES ("7", "11", "2", "3");
INSERT INTO "Student_Enrolment" VALUES ("8", "12", "2", "3");
INSERT INTO "Student_Enrolment" VALUES ("9", "14", "1", "4");
INSERT INTO "Student_Enrolment" VALUES ("10", "15", "1", "4");
INSERT INTO "Student_Enrolment" VALUES ("11", "16", "1", "4");
INSERT INTO "Student_Enrolment" VALUES ("12", "10", "1", "5");
INSERT INTO "Student_Enrolment" VALUES ("13", "11", "1", "5");
INSERT INTO "Student_Enrolment" VALUES ("14", "12", "1", "5");
INSERT INTO "Student_Enrolment" VALUES ("15", "10", "1", "6");
INSERT INTO "Student_Enrolment" VALUES ("16", "11", "2", "6");
INSERT INTO "Student_Enrolment" VALUES ("17", "10", "1", "7");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1", "101");
INSERT INTO "Student_Enrolment_Courses" VALUES ("2", "102");
INSERT INTO "Student_Enrolment_Courses" VALUES ("3", "103");
INSERT INTO "Student_Enrolment_Courses" VALUES ("4", "104");
INSERT INTO "Student_Enrolment_Courses" VALUES ("5", "105");
INSERT INTO "Student_Enrolment_Courses" VALUES ("6", "106");
INSERT INTO "Student_Enrolment_Courses" VALUES ("7", "107");