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,
"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 ("Teacher_ID") REFERENCES "teacher"("Teacher_ID"),
FOREIGN KEY ("Course_ID") REFERENCES "course"("Course_ID")
);

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





INSERT INTO "course" VALUES ("1", "2023-09-01", "Mathematics I");
INSERT INTO "course" VALUES ("2", "2023-09-01", "Physics I");
INSERT INTO "course" VALUES ("3", "2023-09-01", "Chemistry I");
INSERT INTO "course" VALUES ("4", "2023-09-15", "Mathematics II");
INSERT INTO "course" VALUES ("5", "2023-09-15", "Physics II");
INSERT INTO "course" VALUES ("6", "2023-10-01", "Computer Science");
INSERT INTO "course" VALUES ("7", "2023-10-01", "Biology");
INSERT INTO "course" VALUES ("8", "2023-10-15", "History");
INSERT INTO "course" VALUES ("9", "2023-10-15", "Literature");
INSERT INTO "course" VALUES ("10", "2023-11-01", "Art");
INSERT INTO "teacher" VALUES ("101", "Alice Smith", "New York");
INSERT INTO "teacher" VALUES ("102", "Bob Johnson", "Los Angeles");
INSERT INTO "teacher" VALUES ("103", "Charlie Brown", "Chicago");
INSERT INTO "teacher" VALUES ("104", "Diana Prince", "Washington D.C.");
INSERT INTO "teacher" VALUES ("105", "Eve Adams", "Houston");
INSERT INTO "teacher" VALUES ("106", "Frank White", "Miami");
INSERT INTO "teacher" VALUES ("107", "Grace Lee", "Seattle");
INSERT INTO "course_arrange" VALUES ("1", "101", "10");
INSERT INTO "course_arrange" VALUES ("2", "101", "10");
INSERT INTO "course_arrange" VALUES ("3", "102", "10");
INSERT INTO "course_arrange" VALUES ("4", "101", "11");
INSERT INTO "course_arrange" VALUES ("5", "103", "11");
INSERT INTO "course_arrange" VALUES ("6", "104", "12");
INSERT INTO "course_arrange" VALUES ("7", "105", "10");
INSERT INTO "course_arrange" VALUES ("8", "106", "11");
INSERT INTO "course_arrange" VALUES ("9", "107", "12");
INSERT INTO "course_arrange" VALUES ("1", "104", "9");
INSERT INTO "course_arrange" VALUES ("2", "104", "9");
INSERT INTO "course_arrange" VALUES ("3", "104", "9");
INSERT INTO "course_arrange" VALUES ("4", "102", "10");
INSERT INTO "course_arrange" VALUES ("5", "102", "10");
INSERT INTO "course_arrange" VALUES ("6", "101", "10");
INSERT INTO "course_arrange" VALUES ("7", "101", "11");
INSERT INTO "course_arrange" VALUES ("8", "101", "12");
INSERT INTO "course_arrange" VALUES ("9", "101", "12");
INSERT INTO "course_arrange" VALUES ("10", "101", "12");
INSERT INTO "course_arrange" VALUES ("10", "102", "11");