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"),
FOREIGN KEY ("student_id") REFERENCES "Students"("student_id")
);

CREATE TABLE "Student_Enrolment_Courses" (
"student_course_id" INT UNIQUE,
PRIMARY KEY ("student_course_id")
);

CREATE TABLE "Students" (
"student_id" INT,
"first_name" VARCHAR(80),
PRIMARY KEY ("student_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", "Calculus I");
INSERT INTO "Courses" VALUES ("2", "Linear Algebra");
INSERT INTO "Courses" VALUES ("3", "Introduction to Programming");
INSERT INTO "Courses" VALUES ("4", "Data Structures");
INSERT INTO "Courses" VALUES ("5", "Database Systems");
INSERT INTO "Courses" VALUES ("6", "Operating Systems");
INSERT INTO "Courses" VALUES ("7", "Discrete Mathematics");
INSERT INTO "Courses" VALUES ("8", "Web Development");
INSERT INTO "Courses" VALUES ("9", "Artificial Intelligence");
INSERT INTO "Courses" VALUES ("10", "Machine Learning");
INSERT INTO "Students" VALUES ("101", "Alice");
INSERT INTO "Students" VALUES ("102", "Bob");
INSERT INTO "Students" VALUES ("103", "Charlie");
INSERT INTO "Students" VALUES ("104", "David");
INSERT INTO "Students" VALUES ("105", "Eve");
INSERT INTO "Students" VALUES ("106", "Frank");
INSERT INTO "Students" VALUES ("107", "Grace");
INSERT INTO "Student_Enrolment" VALUES ("1", "101");
INSERT INTO "Student_Enrolment" VALUES ("2", "102");
INSERT INTO "Student_Enrolment" VALUES ("3", "103");
INSERT INTO "Student_Enrolment" VALUES ("4", "104");
INSERT INTO "Student_Enrolment" VALUES ("5", "105");
INSERT INTO "Student_Enrolment" VALUES ("6", "106");
INSERT INTO "Student_Enrolment" VALUES ("7", "107");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1001");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1002");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1003");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1004");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1005");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1006");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1007");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1008");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1009");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1010");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1011");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1012");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1013");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1014");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1015");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1016");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1017");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1018");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1019");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1020");
INSERT INTO "Transcripts" VALUES ("201", "2023-01-15 10:00:00");
INSERT INTO "Transcripts" VALUES ("202", "2023-02-20 11:30:00");
INSERT INTO "Transcripts" VALUES ("203", "2023-03-10 09:00:00");
INSERT INTO "Transcripts" VALUES ("204", "2023-04-05 14:00:00");
INSERT INTO "Transcripts" VALUES ("205", "2023-05-12 16:00:00");
INSERT INTO "Transcripts" VALUES ("206", "2023-06-01 08:00:00");
INSERT INTO "Transcripts" VALUES ("207", "2023-07-07 13:00:00");
INSERT INTO "Transcripts" VALUES ("208", "2023-08-18 10:00:00");
INSERT INTO "Transcript_Contents" VALUES ("1001", "201");
INSERT INTO "Transcript_Contents" VALUES ("1002", "201");
INSERT INTO "Transcript_Contents" VALUES ("1003", "201");
INSERT INTO "Transcript_Contents" VALUES ("1004", "202");
INSERT INTO "Transcript_Contents" VALUES ("1005", "202");
INSERT INTO "Transcript_Contents" VALUES ("1006", "203");
INSERT INTO "Transcript_Contents" VALUES ("1007", "204");
INSERT INTO "Transcript_Contents" VALUES ("1008", "204");
INSERT INTO "Transcript_Contents" VALUES ("1009", "204");
INSERT INTO "Transcript_Contents" VALUES ("1010", "204");
INSERT INTO "Transcript_Contents" VALUES ("1011", "205");
INSERT INTO "Transcript_Contents" VALUES ("1012", "206");
INSERT INTO "Transcript_Contents" VALUES ("1013", "206");
INSERT INTO "Transcript_Contents" VALUES ("1014", "207");
INSERT INTO "Transcript_Contents" VALUES ("1015", "207");
INSERT INTO "Transcript_Contents" VALUES ("1016", "207");
INSERT INTO "Transcript_Contents" VALUES ("1017", "208");
INSERT INTO "Transcript_Contents" VALUES ("1018", "208");
INSERT INTO "Transcript_Contents" VALUES ("1019", "208");
INSERT INTO "Transcript_Contents" VALUES ("1020", "208");