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 UNIQUE,
"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 ("101", "2023-09-01", "Mathematics I");
INSERT INTO "course" VALUES ("102", "2023-09-01", "Physics Fundamentals");
INSERT INTO "course" VALUES ("103", "2023-09-01", "Chemistry Basics");
INSERT INTO "course" VALUES ("104", "2023-09-15", "English Literature");
INSERT INTO "course" VALUES ("105", "2023-09-15", "Computer Science I");
INSERT INTO "course" VALUES ("106", "2023-10-01", "History of Art");
INSERT INTO "course" VALUES ("107", "2023-10-01", "Biology Advanced");
INSERT INTO "course" VALUES ("108", "2023-10-15", "Economics Principles");
INSERT INTO "course" VALUES ("109", "2023-11-01", "Mathematics II");
INSERT INTO "course" VALUES ("110", "2023-11-01", "Physics II");
INSERT INTO "teacher" VALUES ("1", "Alice Smith", "New York");
INSERT INTO "teacher" VALUES ("2", "Bob Johnson", "Los Angeles");
INSERT INTO "teacher" VALUES ("3", "Charlie Brown", "Chicago");
INSERT INTO "teacher" VALUES ("4", "Diana Prince", "London");
INSERT INTO "teacher" VALUES ("5", "Eve Adams", "Paris");
INSERT INTO "teacher" VALUES ("6", "Frank White", "Berlin");
INSERT INTO "teacher" VALUES ("7", "Grace Lee", "Tokyo");
INSERT INTO "teacher" VALUES ("8", "Henry King", "Sydney");
INSERT INTO "course_arrange" VALUES ("101", "1", "90");
INSERT INTO "course_arrange" VALUES ("101", "1", "85");
INSERT INTO "course_arrange" VALUES ("102", "2", "78");
INSERT INTO "course_arrange" VALUES ("103", "3", "92");
INSERT INTO "course_arrange" VALUES ("104", "4", "88");
INSERT INTO "course_arrange" VALUES ("105", "5", "95");
INSERT INTO "course_arrange" VALUES ("106", "6", "80");
INSERT INTO "course_arrange" VALUES ("107", "7", "87");
INSERT INTO "course_arrange" VALUES ("108", "8", "75");
INSERT INTO "course_arrange" VALUES ("109", "1", "89");
INSERT INTO "course_arrange" VALUES ("110", "2", "82");
INSERT INTO "course_arrange" VALUES ("101", "3", "70");
INSERT INTO "course_arrange" VALUES ("105", "4", "91");
INSERT INTO "course_arrange" VALUES ("102", "5", "79");
INSERT INTO "course_arrange" VALUES ("103", "6", "84");
INSERT INTO "course_arrange" VALUES ("104", "7", "77");
INSERT INTO "course_arrange" VALUES ("106", "8", "81");