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 "course" (
"Course_ID" INT,
"Staring_Date" TEXT,
PRIMARY KEY ("Course_ID")
);

CREATE TABLE "course_arrange" (
"Course_ID" INT,
"Teacher_ID" INT,
"Grade" INT,
PRIMARY KEY ("Course_ID", "Teacher_ID", "Grade")
);

CREATE TABLE "teacher" (
"Teacher_ID" INT UNIQUE,
"Hometown" TEXT,
PRIMARY KEY ("Teacher_ID")
);





INSERT INTO "teacher" VALUES ("1", "Springfield");
INSERT INTO "teacher" VALUES ("2", "Rivertown");
INSERT INTO "teacher" VALUES ("3", "Springfield");
INSERT INTO "teacher" VALUES ("4", "Lakeside");
INSERT INTO "teacher" VALUES ("5", "Rivertown");
INSERT INTO "teacher" VALUES ("6", "Hill Valley");
INSERT INTO "teacher" VALUES ("7", "Springfield");
INSERT INTO "teacher" VALUES ("8", "Maplewood");
INSERT INTO "teacher" VALUES ("9", "Lakeside");
INSERT INTO "teacher" VALUES ("10", "Greenfield");
INSERT INTO "teacher" VALUES ("11", "Greenfield");
INSERT INTO "teacher" VALUES ("12", "Oakridge");
INSERT INTO "teacher" VALUES ("13", "Maplewood");
INSERT INTO "teacher" VALUES ("14", "Rivertown");
INSERT INTO "teacher" VALUES ("15", "Hill Valley");
INSERT INTO "teacher" VALUES ("16", "Sunnyvale");
INSERT INTO "teacher" VALUES ("17", "Sunnyvale");
INSERT INTO "teacher" VALUES ("18", "Sunnyvale");
INSERT INTO "teacher" VALUES ("19", "Oakridge");
INSERT INTO "teacher" VALUES ("20", "Elmwood");
INSERT INTO "course" VALUES ("101", "2023-01-15");
INSERT INTO "course" VALUES ("102", "2023-02-20");
INSERT INTO "course" VALUES ("103", "2023-03-10");
INSERT INTO "course" VALUES ("104", "2023-04-05");
INSERT INTO "course" VALUES ("105", "2023-05-12");
INSERT INTO "course_arrange" VALUES ("101", "1", "9");
INSERT INTO "course_arrange" VALUES ("101", "2", "8");
INSERT INTO "course_arrange" VALUES ("102", "3", "7");
INSERT INTO "course_arrange" VALUES ("102", "4", "6");
INSERT INTO "course_arrange" VALUES ("103", "5", "9");
INSERT INTO "course_arrange" VALUES ("103", "6", "8");
INSERT INTO "course_arrange" VALUES ("104", "7", "7");
INSERT INTO "course_arrange" VALUES ("104", "8", "6");
INSERT INTO "course_arrange" VALUES ("105", "9", "9");
INSERT INTO "course_arrange" VALUES ("105", "10", "8");