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 Kids", "UK");
INSERT INTO "TV_Channel" VALUES ("FR2", "France 2", "France");
INSERT INTO "TV_Channel" VALUES ("JPX", "Japanimation", "Japan");
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", "Butch Hartman", "NICK");
INSERT INTO "Cartoon" VALUES ("105", "Todd Casey", "BBC");
INSERT INTO "Cartoon" VALUES ("106", "Craig McCracken", "CN");
INSERT INTO "Cartoon" VALUES ("107", "Todd Casey", "FR2");
INSERT INTO "Cartoon" VALUES ("108", "Hayao Miyazaki", "JPX");
INSERT INTO "Cartoon" VALUES ("109", "Todd Casey", "CBC");
INSERT INTO "Cartoon" VALUES ("110", "Seth MacFarlane", "NICK");
INSERT INTO "TV_series" VALUES ("201", "2000-01-01", "CN");
INSERT INTO "TV_series" VALUES ("202", "2005-03-15", "DIS");
INSERT INTO "TV_series" VALUES ("203", "2010-07-20", "NICK");
INSERT INTO "TV_series" VALUES ("204", "2012-11-01", "BBC");
INSERT INTO "TV_series" VALUES ("205", "2015-04-22", "FR2");
INSERT INTO "TV_series" VALUES ("206", "2018-09-10", "JPX");
INSERT INTO "TV_series" VALUES ("207", "2020-02-29", "CBC");