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

CREATE TABLE "Sections" (
"section_id" INT,
"section_name" VARCHAR(255),
PRIMARY KEY ("section_id")
);

CREATE TABLE "Student_Enrolment_Courses" (
"student_course_id" INT,
"course_id" INT,
"student_enrolment_id" INT,
PRIMARY KEY ("student_course_id"),
FOREIGN KEY ("course_id") REFERENCES "Courses"("course_id")
);

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





INSERT INTO "Courses" VALUES ("1", "Introduction to Programming");
INSERT INTO "Courses" VALUES ("2", "Database Management Systems");
INSERT INTO "Courses" VALUES ("3", "Data Structures and Algorithms");
INSERT INTO "Courses" VALUES ("4", "Operating Systems");
INSERT INTO "Courses" VALUES ("5", "Web Development Fundamentals");
INSERT INTO "Courses" VALUES ("6", "Artificial Intelligence");
INSERT INTO "Courses" VALUES ("7", "Calculus I");
INSERT INTO "Courses" VALUES ("8", "Linear Algebra");
INSERT INTO "Courses" VALUES ("9", "Discrete Mathematics");
INSERT INTO "Courses" VALUES ("10", "Computer Networks");
INSERT INTO "Sections" VALUES ("101", "Fall 2023 - Section A");
INSERT INTO "Sections" VALUES ("102", "Fall 2023 - Section B");
INSERT INTO "Sections" VALUES ("103", "Spring 2024 - Section A");
INSERT INTO "Sections" VALUES ("104", "Spring 2024 - Section B");
INSERT INTO "Sections" VALUES ("105", "Summer 2024 - Section A");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1", "1", "1001");
INSERT INTO "Student_Enrolment_Courses" VALUES ("2", "1", "1002");
INSERT INTO "Student_Enrolment_Courses" VALUES ("3", "1", "1003");
INSERT INTO "Student_Enrolment_Courses" VALUES ("4", "1", "1004");
INSERT INTO "Student_Enrolment_Courses" VALUES ("5", "1", "1005");
INSERT INTO "Student_Enrolment_Courses" VALUES ("6", "2", "1001");
INSERT INTO "Student_Enrolment_Courses" VALUES ("7", "2", "1002");
INSERT INTO "Student_Enrolment_Courses" VALUES ("8", "2", "1006");
INSERT INTO "Student_Enrolment_Courses" VALUES ("9", "3", "1003");
INSERT INTO "Student_Enrolment_Courses" VALUES ("10", "3", "1004");
INSERT INTO "Student_Enrolment_Courses" VALUES ("11", "3", "1007");
INSERT INTO "Student_Enrolment_Courses" VALUES ("12", "4", "1005");
INSERT INTO "Student_Enrolment_Courses" VALUES ("13", "4", "1006");
INSERT INTO "Student_Enrolment_Courses" VALUES ("14", "5", "1001");
INSERT INTO "Student_Enrolment_Courses" VALUES ("15", "5", "1007");
INSERT INTO "Student_Enrolment_Courses" VALUES ("16", "6", "1002");
INSERT INTO "Student_Enrolment_Courses" VALUES ("17", "7", "1003");
INSERT INTO "Student_Enrolment_Courses" VALUES ("18", "8", "1004");
INSERT INTO "Student_Enrolment_Courses" VALUES ("19", "9", "1005");
INSERT INTO "Student_Enrolment_Courses" VALUES ("20", "10", "1006");
INSERT INTO "Student_Enrolment_Courses" VALUES ("21", "1", "1006");
INSERT INTO "Student_Enrolment_Courses" VALUES ("22", "1", "1007");
INSERT INTO "Student_Enrolment_Courses" VALUES ("23", "2", "1003");
INSERT INTO "Student_Enrolment_Courses" VALUES ("24", "2", "1004");
INSERT INTO "Student_Enrolment_Courses" VALUES ("25", "3", "1001");
INSERT INTO "Student_Enrolment_Courses" VALUES ("26", "3", "1002");
INSERT INTO "Student_Enrolment_Courses" VALUES ("27", "4", "1001");
INSERT INTO "Student_Enrolment_Courses" VALUES ("28", "4", "1002");
INSERT INTO "Student_Enrolment_Courses" VALUES ("29", "5", "1003");
INSERT INTO "Student_Enrolment_Courses" VALUES ("30", "5", "1004");
INSERT INTO "Student_Enrolment_Courses" VALUES ("31", "1", "1008");
INSERT INTO "Student_Enrolment_Courses" VALUES ("32", "1", "1009");
INSERT INTO "Student_Enrolment_Courses" VALUES ("33", "1", "1010");
INSERT INTO "Student_Enrolment_Courses" VALUES ("34", "2", "1008");
INSERT INTO "Student_Enrolment_Courses" VALUES ("35", "3", "1009");
INSERT INTO "Student_Enrolment_Courses" VALUES ("36", "4", "1010");
INSERT INTO "Student_Enrolment_Courses" VALUES ("37", "5", "1008");
INSERT INTO "Student_Enrolment_Courses" VALUES ("38", "6", "1009");
INSERT INTO "Student_Enrolment_Courses" VALUES ("39", "7", "1010");
INSERT INTO "Student_Enrolment_Courses" VALUES ("40", "8", "1001");
INSERT INTO "Student_Enrolment_Courses" VALUES ("41", "9", "1002");
INSERT INTO "Student_Enrolment_Courses" VALUES ("42", "10", "1003");
INSERT INTO "Students" VALUES ("1001", "Alice", "Smith");
INSERT INTO "Students" VALUES ("1002", "Bob", "Johnson");
INSERT INTO "Students" VALUES ("1003", "Charlie", "Brown");
INSERT INTO "Students" VALUES ("1004", "Diana", "Miller");
INSERT INTO "Students" VALUES ("1005", "Eve", "Davis");
INSERT INTO "Students" VALUES ("1006", "Frank", "Garcia");
INSERT INTO "Students" VALUES ("1007", "Grace", "Rodriguez");
INSERT INTO "Students" VALUES ("1008", "Henry", "Martinez");
INSERT INTO "Students" VALUES ("1009", "Ivy", "Hernandez");
INSERT INTO "Students" VALUES ("1010", "Jack", "Lopez");