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_Courses" (
"student_course_id" INT UNIQUE,
"course_id" INT,
"student_enrolment_id" INT,
PRIMARY KEY ("student_course_id"),
FOREIGN KEY ("course_id") REFERENCES "Courses"("course_id")
);

CREATE TABLE "Students" (
"student_id" INT,
"first_name" VARCHAR(80),
"last_name" VARCHAR(40),
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,
PRIMARY KEY ("transcript_id")
);





INSERT INTO "Courses" VALUES ("1", "Introduction to Programming");
INSERT INTO "Courses" VALUES ("2", "Database Management");
INSERT INTO "Courses" VALUES ("3", "Web Development Basics");
INSERT INTO "Courses" VALUES ("4", "Advanced Algorithms");
INSERT INTO "Courses" VALUES ("5", "Data Structures");
INSERT INTO "Courses" VALUES ("6", "Operating Systems");
INSERT INTO "Students" VALUES ("101", "Alice", "Smith");
INSERT INTO "Students" VALUES ("102", "Bob", "Johnson");
INSERT INTO "Students" VALUES ("103", "Charlie", "Brown");
INSERT INTO "Students" VALUES ("104", "Diana", "Prince");
INSERT INTO "Students" VALUES ("105", "Eve", "Adams");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1001", "1", "101");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1002", "2", "101");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1003", "1", "102");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1004", "3", "102");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1005", "2", "103");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1006", "4", "103");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1007", "5", "104");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1008", "6", "104");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1009", "1", "105");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1010", "2", "105");
INSERT INTO "Student_Enrolment_Courses" VALUES ("1011", "3", "105");
INSERT INTO "Transcripts" VALUES ("1");
INSERT INTO "Transcripts" VALUES ("2");
INSERT INTO "Transcripts" VALUES ("3");
INSERT INTO "Transcripts" VALUES ("4");
INSERT INTO "Transcripts" VALUES ("5");
INSERT INTO "Transcripts" VALUES ("6");
INSERT INTO "Transcripts" VALUES ("7");
INSERT INTO "Transcripts" VALUES ("8");
INSERT INTO "Transcripts" VALUES ("9");
INSERT INTO "Transcripts" VALUES ("10");
INSERT INTO "Transcript_Contents" VALUES ("1001", "1");
INSERT INTO "Transcript_Contents" VALUES ("1001", "2");
INSERT INTO "Transcript_Contents" VALUES ("1001", "3");
INSERT INTO "Transcript_Contents" VALUES ("1002", "1");
INSERT INTO "Transcript_Contents" VALUES ("1002", "4");
INSERT INTO "Transcript_Contents" VALUES ("1003", "5");
INSERT INTO "Transcript_Contents" VALUES ("1003", "6");
INSERT INTO "Transcript_Contents" VALUES ("1003", "7");
INSERT INTO "Transcript_Contents" VALUES ("1003", "8");
INSERT INTO "Transcript_Contents" VALUES ("1004", "5");
INSERT INTO "Transcript_Contents" VALUES ("1005", "9");
INSERT INTO "Transcript_Contents" VALUES ("1006", "9");
INSERT INTO "Transcript_Contents" VALUES ("1007", "10");
INSERT INTO "Transcript_Contents" VALUES ("1008", "10");
INSERT INTO "Transcript_Contents" VALUES ("1009", "1");
INSERT INTO "Transcript_Contents" VALUES ("1010", "2");
INSERT INTO "Transcript_Contents" VALUES ("1011", "3");
INSERT INTO "Transcript_Contents" VALUES ("1001", "9");
INSERT INTO "Transcript_Contents" VALUES ("1001", "10");