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

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

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





INSERT INTO "TV_Channel" VALUES ("CH1", "Sky Radio");
INSERT INTO "TV_Channel" VALUES ("CH2", "Ocean TV");
INSERT INTO "TV_Channel" VALUES ("CH3", "Sky Radio");
INSERT INTO "TV_Channel" VALUES ("CH4", "Mountain View");
INSERT INTO "TV_Channel" VALUES ("CH5", "Sky Radio");
INSERT INTO "Cartoon" VALUES ("101", "Adventures of Sky", "CH1");
INSERT INTO "Cartoon" VALUES ("102", "Ocean Quest", "CH2");
INSERT INTO "Cartoon" VALUES ("103", "Sky High Flyers", "CH3");
INSERT INTO "Cartoon" VALUES ("104", "Mountain Tales", "CH4");
INSERT INTO "Cartoon" VALUES ("105", "Sky Legends", "CH5");
INSERT INTO "Cartoon" VALUES ("106", "City Life", "CH2");
INSERT INTO "Cartoon" VALUES ("107", "Sky Explorers", "CH1");
INSERT INTO "Cartoon" VALUES ("108", "Jungle Fun", "CH4");
INSERT INTO "TV_series" VALUES ("201", "Episode 1", "2023-01-01", "CH1");
INSERT INTO "TV_series" VALUES ("202", "Episode 2", "2023-01-08", "CH1");
INSERT INTO "TV_series" VALUES ("203", "Episode 1", "2023-02-01", "CH2");
INSERT INTO "TV_series" VALUES ("204", "Episode 1", "2023-03-01", "CH3");
INSERT INTO "TV_series" VALUES ("205", "Episode 2", "2023-03-08", "CH3");
INSERT INTO "TV_series" VALUES ("206", "Episode 1", "2023-04-01", "CH4");
INSERT INTO "TV_series" VALUES ("207", "Episode 1", "2023-05-01", "CH5");
INSERT INTO "TV_series" VALUES ("208", "Episode 2", "2023-05-08", "CH5");