-- Schema: spider__tvshow
CREATE SCHEMA IF NOT EXISTS "spider__tvshow";

-- Table: Cartoon
CREATE TABLE "spider__tvshow"."Cartoon" (
    "id" DOUBLE PRECISION NOT NULL,
    "Title" TEXT,
    "Directed_by" TEXT,
    "Written_by" TEXT,
    "Original_air_date" TEXT,
    "Production_code" DOUBLE PRECISION,
    "Channel" TEXT,
    CONSTRAINT "Cartoon_pkey" PRIMARY KEY ("id")
);

-- Table: TV_Channel
CREATE TABLE "spider__tvshow"."TV_Channel" (
    "id" TEXT NOT NULL,
    "series_name" TEXT,
    "Country" TEXT,
    "Language" TEXT,
    "Content" TEXT,
    "Pixel_aspect_ratio_PAR" TEXT,
    "Hight_definition_TV" TEXT,
    "Pay_per_view_PPV" TEXT,
    "Package_Option" TEXT,
    CONSTRAINT "TV_Channel_pkey" PRIMARY KEY ("id")
);

-- Table: TV_series
CREATE TABLE "spider__tvshow"."TV_series" (
    "id" DOUBLE PRECISION NOT NULL,
    "Episode" TEXT,
    "Air_Date" TEXT,
    "Rating" TEXT,
    "Share" DOUBLE PRECISION,
    "18_49_Rating_Share" TEXT,
    "Viewers_m" TEXT,
    "Weekly_Rank" DOUBLE PRECISION,
    "Channel" TEXT,
    CONSTRAINT "TV_series_pkey" PRIMARY KEY ("id")
);

-- Foreign Keys
ALTER TABLE "spider__tvshow"."Cartoon" ADD CONSTRAINT "fk_Cartoon_0" FOREIGN KEY ("Channel") REFERENCES "spider__tvshow"."TV_Channel" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "spider__tvshow"."TV_series" ADD CONSTRAINT "fk_TV_series_0" FOREIGN KEY ("Channel") REFERENCES "spider__tvshow"."TV_Channel" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
