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 "Cartoon" (
"id" FLOAT,
"Original_air_date" TEXT,
PRIMARY KEY ("id")
);

CREATE TABLE "TV_Channel" (
"id" TEXT UNIQUE,
"Country" TEXT,
PRIMARY KEY ("id")
);

CREATE TABLE "TV_series" (
"id" FLOAT,
"Episode" TEXT,
"Rating" TEXT,
"Weekly_Rank" FLOAT,
"Channel" TEXT,
PRIMARY KEY ("id"),
FOREIGN KEY ("Channel") REFERENCES "TV_Channel"("id")
);





INSERT INTO "Cartoon" VALUES ("1", "2023-01-15");
INSERT INTO "Cartoon" VALUES ("2", "2023-02-20");
INSERT INTO "Cartoon" VALUES ("3", "2023-03-10");
INSERT INTO "Cartoon" VALUES ("4", "2023-04-05");
INSERT INTO "Cartoon" VALUES ("5", "2023-05-01");
INSERT INTO "TV_Channel" VALUES ("CH001", "USA");
INSERT INTO "TV_Channel" VALUES ("CH002", "UK");
INSERT INTO "TV_Channel" VALUES ("CH003", "Canada");
INSERT INTO "TV_Channel" VALUES ("CH004", "Australia");
INSERT INTO "TV_Channel" VALUES ("CH005", "Germany");
INSERT INTO "TV_series" VALUES ("101", "A Love of a Lifetime", "8.7", "3", "CH001");
INSERT INTO "TV_series" VALUES ("102", "The Great Escape", "7.5", "10", "CH002");
INSERT INTO "TV_series" VALUES ("103", "Mystery Night", "9.1", "1", "CH003");
INSERT INTO "TV_series" VALUES ("104", "A Love of a Lifetime", "8.3", "5", "CH004");
INSERT INTO "TV_series" VALUES ("105", "Final Hour", "6.9", "15", "CH005");
INSERT INTO "TV_series" VALUES ("106", "A Love of a Lifetime", "7.8", "8", "CH002");
INSERT INTO "TV_series" VALUES ("107", "The Great Escape", "8.0", "7", "CH001");
INSERT INTO "TV_series" VALUES ("108", "Mystery Night", "8.5", "4", "CH004");
INSERT INTO "TV_series" VALUES ("109", "Final Hour", "7.2", "12", "CH003");
INSERT INTO "TV_series" VALUES ("110", "A Love of a Lifetime", "9.0", "2", "CH005");