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

-- Table: department
CREATE TABLE "spider__department_management"."department" (
    "Department_ID" BIGINT NOT NULL,
    "Name" TEXT,
    "Creation" TEXT,
    "Ranking" BIGINT,
    "Budget_in_Billions" DOUBLE PRECISION,
    "Num_Employees" DOUBLE PRECISION,
    CONSTRAINT "department_pkey" PRIMARY KEY ("Department_ID")
);

-- Table: head
CREATE TABLE "spider__department_management"."head" (
    "head_ID" BIGINT NOT NULL,
    "name" TEXT,
    "born_state" TEXT,
    "age" DOUBLE PRECISION,
    CONSTRAINT "head_pkey" PRIMARY KEY ("head_ID")
);

-- Table: management
CREATE TABLE "spider__department_management"."management" (
    "department_ID" BIGINT NOT NULL,
    "head_ID" BIGINT NOT NULL,
    "temporary_acting" TEXT,
    CONSTRAINT "management_pkey" PRIMARY KEY ("department_ID", "head_ID")
);

-- Foreign Keys
ALTER TABLE "spider__department_management"."management" ADD CONSTRAINT "fk_management_0" FOREIGN KEY ("head_ID") REFERENCES "spider__department_management"."head" ("head_ID") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "spider__department_management"."management" ADD CONSTRAINT "fk_management_1" FOREIGN KEY ("department_ID") REFERENCES "spider__department_management"."department" ("Department_ID") ON DELETE NO ACTION ON UPDATE NO ACTION;
