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

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

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





INSERT INTO "course" VALUES ("1", "Mathematics");
INSERT INTO "course" VALUES ("2", "Physics");
INSERT INTO "course" VALUES ("3", "Chemistry");
INSERT INTO "course" VALUES ("4", "Biology");
INSERT INTO "course" VALUES ("5", "History");
INSERT INTO "course" VALUES ("6", "Literature");
INSERT INTO "teacher" VALUES ("101", "New York");
INSERT INTO "teacher" VALUES ("102", "Los Angeles");
INSERT INTO "teacher" VALUES ("103", "New York");
INSERT INTO "teacher" VALUES ("104", "Chicago");
INSERT INTO "teacher" VALUES ("105", "New York");
INSERT INTO "teacher" VALUES ("106", "Houston");
INSERT INTO "teacher" VALUES ("107", "Los Angeles");
INSERT INTO "teacher" VALUES ("108", "Chicago");
INSERT INTO "teacher" VALUES ("109", "Houston");
INSERT INTO "teacher" VALUES ("110", "New York");
INSERT INTO "teacher" VALUES ("111", "Phoenix");
INSERT INTO "teacher" VALUES ("112", "Philadelphia");
INSERT INTO "teacher" VALUES ("113", "San Antonio");
INSERT INTO "teacher" VALUES ("114", "San Diego");
INSERT INTO "teacher" VALUES ("115", "Dallas");
INSERT INTO "course_arrange" VALUES ("1", "101", "9");
INSERT INTO "course_arrange" VALUES ("1", "102", "10");
INSERT INTO "course_arrange" VALUES ("2", "103", "9");
INSERT INTO "course_arrange" VALUES ("2", "104", "10");
INSERT INTO "course_arrange" VALUES ("3", "105", "11");
INSERT INTO "course_arrange" VALUES ("3", "106", "12");
INSERT INTO "course_arrange" VALUES ("4", "107", "9");
INSERT INTO "course_arrange" VALUES ("4", "108", "10");
INSERT INTO "course_arrange" VALUES ("5", "109", "11");
INSERT INTO "course_arrange" VALUES ("5", "110", "12");
INSERT INTO "course_arrange" VALUES ("6", "111", "9");
INSERT INTO "course_arrange" VALUES ("6", "112", "10");
INSERT INTO "course_arrange" VALUES ("1", "113", "11");
INSERT INTO "course_arrange" VALUES ("2", "114", "12");
INSERT INTO "course_arrange" VALUES ("3", "115", "9");