CREATE TABLE range_parted (
join_date date
) PARTITION BY RANGE (join_date);
CREATE TABLE range_parted1 PARTITION OF range_parted FOR VALUES from ( '2018-01-01') TO ( '2018-02-01');
CREATE TABLE range_parted2 PARTITION OF range_parted FOR VALUES FROM ( '2018-02-01') TO ( '2018-03-01');
CREATE TABLE range_parted3 PARTITION OF range_parted FOR VALUES FROM ( '2018-03-01') TO ( '2018-04-01');
insert into range_parted1 values('2018-02-01');
join_date date
) PARTITION BY RANGE (join_date);
CREATE TABLE range_parted1 PARTITION OF range_parted FOR VALUES from ( '2018-01-01') TO ( '2018-02-01');
CREATE TABLE range_parted2 PARTITION OF range_parted FOR VALUES FROM ( '2018-02-01') TO ( '2018-03-01');
CREATE TABLE range_parted3 PARTITION OF range_parted FOR VALUES FROM ( '2018-03-01') TO ( '2018-04-01');
insert into range_parted1 values('2018-02-01');
explain select *from range_parted where join_date='2018-02-01';
自己调试后发现重点写法 from ( '2018-01-01') TO ( '2018-02-01');
from里的值表示包含这个值,to里的值不包含。