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

CREATE TABLE "Student_Enrolment" (
"student_enrolment_id" INT,
"student_id" INT,
PRIMARY KEY ("student_enrolment_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 "Transcript_Contents" (
"student_course_id" INT,
"transcript_id" INT,
FOREIGN KEY ("transcript_id") REFERENCES "Transcripts"("transcript_id"),
FOREIGN KEY ("student_course_id") REFERENCES "Student_Enrolment_Courses"("student_course_id")
);

CREATE TABLE "Transcripts" (
"transcript_id" INT UNIQUE,
"transcript_date" DATETIME,
PRIMARY KEY ("transcript_id")
);





INSERT INTO "Courses" VALUES ("1", "Mathematics I");
INSERT INTO "Courses" VALUES ("2", "Physics I");
INSERT INTO "Courses" VALUES ("3", "Chemistry I");
INSERT INTO "Courses" VALUES ("4", "Computer Science Fundamentals");
INSERT INTO "Courses" VALUES ("5", "History of Art");
INSERT INTO "Courses" VALUES ("6", "Biology");
INSERT INTO "Courses" VALUES ("7", "Literature");
INSERT INTO "Courses" VALUES ("8", "Economics");
INSERT INTO "Student_Enrolment" VALUES ("101", "1");
INSERT INTO "Student_Enrolment" VALUES ("102", "2");
INSERT INTO "Student_Enrolment" VALUES ("103", "3");
INSERT INTO "Student_Enrolment" VALUES ("104", "4");
INSERT INTO "Student_Enrolment" VALUES ("105", "5");
INSERT INTO "Student_Enrolment" VALUES ("106", "6");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1001", "1");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1002", "2");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1003", "3");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1004", "4");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1005", "1");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1006", "5");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1007", "6");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1008", "7");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1009", "8");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1010", "2");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1011", "3");
INSERT INTO "Transcripts" VALUES ("1", "2023-01-15");
INSERT INTO "Transcripts" VALUES ("2", "2023-03-20");
INSERT INTO "Transcripts" VALUES ("3", "2023-05-10");
INSERT INTO "Transcripts" VALUES ("4", "2023-07-01");
INSERT INTO "Transcripts" VALUES ("5", "2023-09-05");
INSERT INTO "Transcripts" VALUES ("6", "2023-11-12");
INSERT INTO "Transcripts" VALUES ("7", "2024-01-25");
INSERT INTO "Transcript_Contents" VALUES ("1001", "1");
INSERT INTO "Transcript_Contents" VALUES ("1002", "1");
INSERT INTO "Transcript_Contents" VALUES ("1003", "1");
INSERT INTO "Transcript_Contents" VALUES ("1004", "2");
INSERT INTO "Transcript_Contents" VALUES ("1005", "2");
INSERT INTO "Transcript_Contents" VALUES ("1006", "3");
INSERT INTO "Transcript_Contents" VALUES ("1007", "3");
INSERT INTO "Transcript_Contents" VALUES ("1008", "4");
INSERT INTO "Transcript_Contents" VALUES ("1009", "5");
INSERT INTO "Transcript_Contents" VALUES ("1010", "6");
INSERT INTO "Transcript_Contents" VALUES ("1011", "7");