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





INSERT INTO "course" VALUES ("1", "2023-09-01", "math");
INSERT INTO "course" VALUES ("2", "2023-09-01", "history");
INSERT INTO "course" VALUES ("3", "2023-10-01", "science");
INSERT INTO "course" VALUES ("4", "2023-11-01", "math");
INSERT INTO "course" VALUES ("5", "2023-12-01", "art");
INSERT INTO "teacher" VALUES ("101", "Alice Johnson", "45");
INSERT INTO "teacher" VALUES ("102", "Bob Smith", "38");
INSERT INTO "teacher" VALUES ("103", "Carol White", "50");
INSERT INTO "teacher" VALUES ("104", "David Brown", "29");
INSERT INTO "teacher" VALUES ("105", "Eva Green", "41");
INSERT INTO "course_arrange" VALUES ("1", "101", "9");
INSERT INTO "course_arrange" VALUES ("1", "102", "10");
INSERT INTO "course_arrange" VALUES ("2", "103", "8");
INSERT INTO "course_arrange" VALUES ("3", "104", "7");
INSERT INTO "course_arrange" VALUES ("4", "105", "11");
INSERT INTO "course_arrange" VALUES ("4", "101", "12");
INSERT INTO "course_arrange" VALUES ("5", "102", "6");