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

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

CREATE TABLE "Student_Enrolment" (
"student_enrolment_id" INT UNIQUE,
"semester_id" INT,
PRIMARY KEY ("student_enrolment_id")
);

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





INSERT INTO "Courses" VALUES ("101", "Calculus I", "Introduction to differential and integral calculus");
INSERT INTO "Courses" VALUES ("102", "Physics I", "Fundamentals of mechanics and thermodynamics");
INSERT INTO "Courses" VALUES ("103", "English Literature", "Study of classic and modern literary works");
INSERT INTO "Courses" VALUES ("104", "Computer Science I", "Introduction to programming and algorithms");
INSERT INTO "Courses" VALUES ("105", "History", "World history from ancient to modern times");
INSERT INTO "Sections" VALUES ("1", "Section A");
INSERT INTO "Sections" VALUES ("2", "Section B");
INSERT INTO "Sections" VALUES ("3", "Section C");
INSERT INTO "Student_Enrolment" VALUES ("201", "202301");
INSERT INTO "Student_Enrolment" VALUES ("202", "202301");
INSERT INTO "Student_Enrolment" VALUES ("203", "202301");
INSERT INTO "Student_Enrolment" VALUES ("204", "202302");
INSERT INTO "Student_Enrolment" VALUES ("205", "202302");
INSERT INTO "Student_Enrolment" VALUES ("206", "202302");
INSERT INTO "Student_Enrolment" VALUES ("207", "202303");
INSERT INTO "Student_Enrolment" VALUES ("208", "202303");
INSERT INTO "Student_Enrolment" VALUES ("209", "202303");
INSERT INTO "Student_Enrolment" VALUES ("210", "202303");
INSERT INTO "Student_Enrolment_Courses" VALUES ("301", "101", "201");
INSERT INTO "Student_Enrolment_Courses" VALUES ("302", "101", "202");
INSERT INTO "Student_Enrolment_Courses" VALUES ("303", "101", "203");
INSERT INTO "Student_Enrolment_Courses" VALUES ("304", "102", "201");
INSERT INTO "Student_Enrolment_Courses" VALUES ("305", "102", "204");
INSERT INTO "Student_Enrolment_Courses" VALUES ("306", "103", "205");
INSERT INTO "Student_Enrolment_Courses" VALUES ("307", "104", "206");
INSERT INTO "Student_Enrolment_Courses" VALUES ("308", "104", "207");
INSERT INTO "Student_Enrolment_Courses" VALUES ("309", "104", "208");
INSERT INTO "Student_Enrolment_Courses" VALUES ("310", "104", "209");
INSERT INTO "Student_Enrolment_Courses" VALUES ("311", "105", "210");
INSERT INTO "Student_Enrolment_Courses" VALUES ("312", "105", "204");
INSERT INTO "Student_Enrolment_Courses" VALUES ("313", "105", "205");
INSERT INTO "Student_Enrolment_Courses" VALUES ("314", "105", "206");
INSERT INTO "Student_Enrolment_Courses" VALUES ("315", "105", "207");
INSERT INTO "Student_Enrolment_Courses" VALUES ("316", "105", "208");
INSERT INTO "Student_Enrolment_Courses" VALUES ("317", "105", "209");
INSERT INTO "Student_Enrolment_Courses" VALUES ("318", "105", "210");