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-01-10", "Mathematics");
INSERT INTO "course" VALUES ("102", "2023-02-15", "Physics");
INSERT INTO "course" VALUES ("103", "2023-03-20", "Chemistry");
INSERT INTO "course" VALUES ("104", "2023-04-25", "Biology");
INSERT INTO "course" VALUES ("105", "2023-05-30", "History");
INSERT INTO "course" VALUES ("106", "2023-06-05", "Geography");
INSERT INTO "course" VALUES ("107", "2023-07-10", "Computer Science");
INSERT INTO "course" VALUES ("108", "2023-08-15", "English Literature");
INSERT INTO "teacher" VALUES ("1", "Alice Johnson", "New York");
INSERT INTO "teacher" VALUES ("2", "Bob Smith", "Los Angeles");
INSERT INTO "teacher" VALUES ("3", "Charlie Davis", "Chicago");
INSERT INTO "teacher" VALUES ("4", "Diana Evans", "Houston");
INSERT INTO "teacher" VALUES ("5", "Ethan Brown", "Phoenix");
INSERT INTO "teacher" VALUES ("6", "Fiona Clark", "Philadelphia");
INSERT INTO "teacher" VALUES ("7", "George Miller", "San Antonio");
INSERT INTO "teacher" VALUES ("8", "Hannah Wilson", "San Diego");
INSERT INTO "course_arrange" VALUES ("101", "1", "9");
INSERT INTO "course_arrange" VALUES ("102", "2", "10");
INSERT INTO "course_arrange" VALUES ("103", "3", "11");
INSERT INTO "course_arrange" VALUES ("104", "4", "12");
INSERT INTO "course_arrange" VALUES ("105", "5", "9");
INSERT INTO "course_arrange" VALUES ("106", "6", "10");
INSERT INTO "course_arrange" VALUES ("107", "7", "11");
INSERT INTO "course_arrange" VALUES ("108", "8", "12");
INSERT INTO "course_arrange" VALUES ("101", "2", "9");
INSERT INTO "course_arrange" VALUES ("102", "1", "10");
INSERT INTO "course_arrange" VALUES ("103", "4", "11");
INSERT INTO "course_arrange" VALUES ("104", "3", "12");
INSERT INTO "course_arrange" VALUES ("105", "6", "9");
INSERT INTO "course_arrange" VALUES ("106", "5", "10");
INSERT INTO "course_arrange" VALUES ("107", "8", "11");
INSERT INTO "course_arrange" VALUES ("108", "7", "12");