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", "English Literature", "Study of classic and modern literary works");
INSERT INTO "Courses" VALUES ("103", "Physics I", "Fundamentals of mechanics and thermodynamics");
INSERT INTO "Courses" VALUES ("104", "Art History", "Overview of art movements from Renaissance to Modern");
INSERT INTO "Courses" VALUES ("105", "Computer Science I", "Introduction to programming and algorithms");
INSERT INTO "Courses" VALUES ("106", "Biology I", "Basics of cell biology and genetics");
INSERT INTO "Courses" VALUES ("107", "Philosophy", "Introduction to philosophical thinking and logic");
INSERT INTO "Courses" VALUES ("108", "Statistics", "Basic concepts in probability and statistics");
INSERT INTO "Courses" VALUES ("109", "Chemistry I", "General chemistry principles and lab work");
INSERT INTO "Courses" VALUES ("110", "Economics", "Principles of micro and macroeconomics");
INSERT INTO "Sections" VALUES ("1", "Morning");
INSERT INTO "Sections" VALUES ("2", "Afternoon");
INSERT INTO "Sections" VALUES ("3", "Evening");
INSERT INTO "Student_Enrolment" VALUES ("201", "202201");
INSERT INTO "Student_Enrolment" VALUES ("202", "202201");
INSERT INTO "Student_Enrolment" VALUES ("203", "202202");
INSERT INTO "Student_Enrolment" VALUES ("204", "202202");
INSERT INTO "Student_Enrolment" VALUES ("205", "202203");
INSERT INTO "Student_Enrolment_Courses" VALUES ("301", "101", "201");
INSERT INTO "Student_Enrolment_Courses" VALUES ("302", "102", "201");
INSERT INTO "Student_Enrolment_Courses" VALUES ("303", "103", "202");
INSERT INTO "Student_Enrolment_Courses" VALUES ("304", "105", "203");
INSERT INTO "Student_Enrolment_Courses" VALUES ("305", "106", "204");
INSERT INTO "Student_Enrolment_Courses" VALUES ("306", "108", "205");
INSERT INTO "Student_Enrolment_Courses" VALUES ("307", "101", "205");
INSERT INTO "Student_Enrolment_Courses" VALUES ("308", "109", "202");
INSERT INTO "Student_Enrolment_Courses" VALUES ("309", "110", "203");
INSERT INTO "Student_Enrolment_Courses" VALUES ("310", "104", "204");