File size: 1,424 Bytes
ffba157 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
-- 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;
|