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