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,
"Written_by" TEXT,
"Channel" TEXT,
PRIMARY KEY ("id"),
FOREIGN KEY ("Channel") REFERENCES "TV_Channel"("id")
);

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

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





INSERT INTO "TV_Channel" VALUES ("CN", "Cartoon Network", "USA");
INSERT INTO "TV_Channel" VALUES ("DIS", "Disney Channel", "USA");
INSERT INTO "TV_Channel" VALUES ("NICK", "Nickelodeon", "USA");
INSERT INTO "TV_Channel" VALUES ("BBC", "BBC One", "UK");
INSERT INTO "TV_Channel" VALUES ("TF1", "TF1", "France");
INSERT INTO "TV_Channel" VALUES ("ZDF", "ZDF", "Germany");
INSERT INTO "TV_Channel" VALUES ("ABC", "ABC Kids", "Australia");
INSERT INTO "TV_Channel" VALUES ("CBC", "CBC Kids", "Canada");
INSERT INTO "Cartoon" VALUES ("101", "Todd Casey", "CN");
INSERT INTO "Cartoon" VALUES ("102", "Genndy Tartakovsky", "CN");
INSERT INTO "Cartoon" VALUES ("103", "Todd Casey", "DIS");
INSERT INTO "Cartoon" VALUES ("104", "Craig McCracken", "CN");
INSERT INTO "Cartoon" VALUES ("105", "Todd Casey", "BBC");
INSERT INTO "Cartoon" VALUES ("106", "Butch Hartman", "NICK");
INSERT INTO "Cartoon" VALUES ("107", "Todd Casey", "TF1");
INSERT INTO "Cartoon" VALUES ("108", "Rebecca Sugar", "CN");
INSERT INTO "Cartoon" VALUES ("109", "Todd Casey", "ZDF");
INSERT INTO "Cartoon" VALUES ("110", "Todd Casey", "ABC");
INSERT INTO "Cartoon" VALUES ("111", "Todd Casey", "CBC");
INSERT INTO "TV_series" VALUES ("201", "2023-01-15", "CN");
INSERT INTO "TV_series" VALUES ("202", "2023-02-20", "DIS");
INSERT INTO "TV_series" VALUES ("203", "2023-03-10", "NICK");
INSERT INTO "TV_series" VALUES ("204", "2023-04-05", "BBC");
INSERT INTO "TV_series" VALUES ("205", "2023-05-12", "TF1");
INSERT INTO "TV_series" VALUES ("206", "2023-06-01", "ZDF");
INSERT INTO "TV_series" VALUES ("207", "2023-07-08", "ABC");
INSERT INTO "TV_series" VALUES ("208", "2023-08-19", "CBC");