码迷,mamicode.com
首页 > 其他好文 > 详细

创建分区表

时间:2020-05-04 13:18:33      阅读:55      评论:0      收藏:0      [点我收藏+]

标签:exists   var   tab   org   arch   rom   sts   Plan   art   


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‘)
;

创建分区表

标签:exists   var   tab   org   arch   rom   sts   Plan   art   

原文地址:https://www.cnblogs.com/testzcy/p/12826161.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!