创建分区表
作者:互联网
DROP TABLE IF EXISTS "CNYB"."CT_DAY_PLANT_001";
CREATE TABLE "CNYB"."CT_DAY_PLANT_001"(
"ID" VARCHAR(32) NOT NULL,
"YEAR" VARCHAR(4) NOT NULL,
"DATE" VARCHAR(2) NOT NULL,
"ORG_ID" VARCHAR(18) NOT NULL,
"TYPE" INTEGER NOT NULL,
"CTIME" VARCHAR(19),
"V01" DECIMAL(16,4),
"V02" DECIMAL(16,4),
"V03" DECIMAL(16,4),
CONSTRAINT "CT_DAY_PLANT_001_pkey" PRIMARY KEY ("YEAR","DATE", "ORG_ID", "ID", "TYPE")
)PARTITION BY RANGE ("YEAR");
CREATE TABLE "CNYB"."CT_DAY_PLANT_001_2019" PARTITION OF "CNYB"."CT_DAY_PLANT_001"
FOR VALUES FROM ('2019') TO ('2020')
;
CREATE TABLE "CNYB"."CT_DAY_PLANT_001_2020" PARTITION OF "CNYB"."CT_DAY_PLANT_001"
FOR VALUES FROM ('2020') TO ('2021')
;
CREATE TABLE "CNYB"."CT_DAY_PLANT_001_2021" PARTITION OF "CNYB"."CT_DAY_PLANT_001"
FOR VALUES FROM ('2021') TO ('2022')
;
CREATE TABLE "CNYB"."CT_DAY_PLANT_001_2022" PARTITION OF "CNYB"."CT_DAY_PLANT_001"
FOR VALUES FROM ('2022') TO ('2023')
;
CREATE TABLE "CNYB"."CT_DAY_PLANT_001_2023" PARTITION OF "CNYB"."CT_DAY_PLANT_001"
FOR VALUES FROM ('2023') TO ('2024')
;
CREATE TABLE "CNYB"."CT_DAY_PLANT_001_2024" PARTITION OF "CNYB"."CT_DAY_PLANT_001"
FOR VALUES FROM ('2024') TO ('2025')
;
CREATE TABLE "CNYB"."CT_DAY_PLANT_001_2025" PARTITION OF "CNYB"."CT_DAY_PLANT_001"
FOR VALUES FROM ('2025') TO ('2026')
;
标签:PLANT,创建,CNYB,001,分区表,TABLE,DAY,CT 来源: https://www.cnblogs.com/testzcy/p/12826161.html