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

-- Table: Companies
CREATE TABLE "spider__company_office"."Companies" (
    "id" BIGINT NOT NULL,
    "name" TEXT,
    "Headquarters" TEXT,
    "Industry" TEXT,
    "Sales_billion" DOUBLE PRECISION,
    "Profits_billion" DOUBLE PRECISION,
    "Assets_billion" DOUBLE PRECISION,
    "Market_Value_billion" TEXT,
    CONSTRAINT "Companies_pkey" PRIMARY KEY ("id")
);

-- Table: Office_locations
CREATE TABLE "spider__company_office"."Office_locations" (
    "building_id" BIGINT NOT NULL,
    "company_id" BIGINT NOT NULL,
    "move_in_year" BIGINT,
    CONSTRAINT "Office_locations_pkey" PRIMARY KEY ("building_id", "company_id")
);

-- Table: buildings
CREATE TABLE "spider__company_office"."buildings" (
    "id" BIGINT NOT NULL,
    "name" TEXT,
    "City" TEXT,
    "Height" BIGINT,
    "Stories" BIGINT,
    "Status" TEXT,
    CONSTRAINT "buildings_pkey" PRIMARY KEY ("id")
);

-- Foreign Keys
ALTER TABLE "spider__company_office"."Office_locations" ADD CONSTRAINT "fk_Office_locations_0" FOREIGN KEY ("company_id") REFERENCES "spider__company_office"."Companies" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "spider__company_office"."Office_locations" ADD CONSTRAINT "fk_Office_locations_1" FOREIGN KEY ("building_id") REFERENCES "spider__company_office"."buildings" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
