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 ("SR", "Sky Radio");
INSERT INTO "TV_Channel" VALUES ("CN", "Cartoon Network");
INSERT INTO "TV_Channel" VALUES ("DS", "Disney Channel");
INSERT INTO "TV_Channel" VALUES ("BB", "BBC One");
INSERT INTO "TV_Channel" VALUES ("FX", "FX Channel");
INSERT INTO "Cartoon" VALUES ("1.0", "Tom and Jerry", "CN");
INSERT INTO "Cartoon" VALUES ("2.0", "Looney Tunes", "CN");
INSERT INTO "Cartoon" VALUES ("3.0", "Mickey Mouse Clubhouse", "DS");
INSERT INTO "Cartoon" VALUES ("4.0", "The Simpsons", "FX");
INSERT INTO "TV_series" VALUES ("101.0", "The First Episode", "2023-01-01", "SR");
INSERT INTO "TV_series" VALUES ("102.0", "The Second Episode", "2023-01-08", "SR");
INSERT INTO "TV_series" VALUES ("103.0", "Pilot", "2022-05-10", "CN");
INSERT INTO "TV_series" VALUES ("104.0", "New Beginnings", "2023-03-15", "DS");
INSERT INTO "TV_series" VALUES ("105.0", "The Premiere", "2023-02-20", "BB");
INSERT INTO "TV_series" VALUES ("106.0", "Episode 3", "2023-01-15", "SR");
INSERT INTO "TV_series" VALUES ("107.0", "Special Episode", "2023-04-01", "SR");