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 II");
INSERT INTO "Courses" VALUES ("3", "Computer Science Fundamentals");
INSERT INTO "Courses" VALUES ("4", "History of Art");
INSERT INTO "Courses" VALUES ("5", "Chemistry Basics");
INSERT INTO "Courses" VALUES ("6", "Advanced Calculus");
INSERT INTO "Courses" VALUES ("7", "Data Structures");
INSERT INTO "Courses" VALUES ("8", "Linear Algebra");
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_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", "5");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1006", "1");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1007", "2");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1008", "3");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1009", "6");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1010", "7");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1011", "8");
INSERT INTO "Transcripts" VALUES ("1", "2023-01-15");
INSERT INTO "Transcripts" VALUES ("2", "2023-02-20");
INSERT INTO "Transcripts" VALUES ("3", "2023-03-10");
INSERT INTO "Transcripts" VALUES ("4", "2023-04-05");
INSERT INTO "Transcripts" VALUES ("5", "2023-05-01");
INSERT INTO "Transcripts" VALUES ("6", "2023-06-10");
INSERT INTO "Transcripts" VALUES ("7", "2023-07-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", "3");
INSERT INTO "Transcript_Contents" VALUES ("1009", "4");
INSERT INTO "Transcript_Contents" VALUES ("1010", "5");
INSERT INTO "Transcript_Contents" VALUES ("1011", "6");
INSERT INTO "Transcript_Contents" VALUES ("1001", "7");