数据仓库服务 GAUSSDB(DWS)-PARTITION:RANGE_N with * for start-date

时间:2024-10-26 11:41:18

RANGE_N with * for start-date

输入

CREATE MULTISET TABLE Orders5 (
   StoreNo SMALLINT, 
   OrderNo INTEGER, 
   OrderDate DATE, 
   OrderTotal INTEGER 
) 
PRIMARY INDEX(OrderNo) 
PARTITION BY RANGE_N  (
   OrderDate BETWEEN DATE * AND DATE '2016-12-31' EACH INTERVAL '1' YEAR,
     DATE '2017-01-01'  EACH INTERVAL '1' MONTH,
     DATE '2020-01-01' AND DATE '2020-12-31' EACH INTERVAL '1' DAY
);

输出

CREATE TABLE Orders5 (
   StoreNo SMALLINT, 
   OrderNo INTEGER, 
   OrderDate DATE, 
   OrderTotal INTEGER 
) 
DISTRIBUTE BY HASH (OrderNo) 
PARTITION BY RANGE (OrderDate)
   ( PARTITION Orders5_0 START (DATE '0001-01-01') END (DATE '2016-12-31') EVERY (INTERVAL '1' YEAR),
PARTITION Orders5_1 START (DATE '2016-12-31') END (DATE '2020-01-01') EVERY (INTERVAL '1' MONTH),
PARTITION Orders5_2 START (DATE '2020-01-01') END (DATE '2020-12-31') EVERY (INTERVAL '1' DAY)
);
support.huaweicloud.com/tg-dws/dws_16_0072.html