就是这种
CREATE TABLE tbl1_r (log_id BIGINT NOT NULL,log_value VARCHAR(50),log_date TIMESTAMP NOT NULL)
PARTITION BY RANGE(UNIX_TIMESTAMP(log_date))
(PARTITION M201001 VALUES LESS THAN(UNIX_TIMESTAMP(‘2020/02/01’))
, PARTITION M201002 VALUES LESS THAN(UNIX_TIMESTAMP(‘2020/03/01’))
, PARTITION M201003 VALUES LESS THAN(UNIX_TIMESTAMP(‘2020/04/01’))
, PARTITION M201004 VALUES LESS THAN(UNIX_TIMESTAMP(‘2020/05/01’))
, PARTITION M201005 VALUES LESS THAN(UNIX_TIMESTAMP(‘2020/06/01’))
, PARTITION M201006 VALUES LESS THAN(UNIX_TIMESTAMP(‘2020/07/01’))
, PARTITION M201007 VALUES LESS THAN(UNIX_TIMESTAMP(‘2020/08/01’))
, PARTITION M201008 VALUES LESS THAN(UNIX_TIMESTAMP(‘2020/09/01’))
, PARTITION M201009 VALUES LESS THAN(UNIX_TIMESTAMP(‘2020/10/01’))
, PARTITION M201010 VALUES LESS THAN(UNIX_TIMESTAMP(‘2020/11/01’))
, PARTITION M201011 VALUES LESS THAN(UNIX_TIMESTAMP(‘2020/12/01’))
, PARTITION M201012 VALUES LESS THAN(UNIX_TIMESTAMP(‘2021/01/01’))
,PARTITION M202001 VALUES LESS THAN(UNIX_TIMESTAMP('2021/02/01'))
, PARTITION M202002 VALUES LESS THAN(UNIX_TIMESTAMP('2021/03/01'))
, PARTITION M202003 VALUES LESS THAN(UNIX_TIMESTAMP('2021/04/01'))
, PARTITION M202004 VALUES LESS THAN(UNIX_TIMESTAMP('2021/05/01'))
, PARTITION M202005 VALUES LESS THAN(UNIX_TIMESTAMP('2021/06/01'))
, PARTITION M202006 VALUES LESS THAN(UNIX_TIMESTAMP('2021/07/01'))
, PARTITION M202007 VALUES LESS THAN(UNIX_TIMESTAMP('2021/08/01'))
, PARTITION M202008 VALUES LESS THAN(UNIX_TIMESTAMP('2021/09/01'))
, PARTITION M202009 VALUES LESS THAN(UNIX_TIMESTAMP('2021/10/01'))
, PARTITION M202010 VALUES LESS THAN(UNIX_TIMESTAMP('2021/11/01'))
, PARTITION M202011 VALUES LESS THAN(UNIX_TIMESTAMP('2021/12/01'))
, PARTITION M202012 VALUES LESS THAN(UNIX_TIMESTAMP('2022/01/01'))
,PARTITION M203001 VALUES LESS THAN(UNIX_TIMESTAMP('2022/02/01'))
, PARTITION M203002 VALUES LESS THAN(UNIX_TIMESTAMP('2022/03/01'))
, PARTITION M203003 VALUES LESS THAN(UNIX_TIMESTAMP('2022/04/01'))
, PARTITION M203004 VALUES LESS THAN(UNIX_TIMESTAMP('2022/05/01'))
, PARTITION M203005 VALUES LESS THAN(UNIX_TIMESTAMP('2022/06/01'))
, PARTITION M203006 VALUES LESS THAN(UNIX_TIMESTAMP('2022/07/01'))
, PARTITION M203007 VALUES LESS THAN(UNIX_TIMESTAMP('2022/08/01'))
, PARTITION M203008 VALUES LESS THAN(UNIX_TIMESTAMP('2022/09/01'))
, PARTITION M203009 VALUES LESS THAN(UNIX_TIMESTAMP('2022/10/01'))
, PARTITION M203010 VALUES LESS THAN(UNIX_TIMESTAMP('2022/11/01'))
, PARTITION M203011 VALUES LESS THAN(UNIX_TIMESTAMP('2022/12/01'))
, PARTITION M203012 VALUES LESS THAN(UNIX_TIMESTAMP('2023/01/01'))
,PARTITION M204001 VALUES LESS THAN(UNIX_TIMESTAMP('2023/02/01'))
, PARTITION M204002 VALUES LESS THAN(UNIX_TIMESTAMP('2023/03/01'))
, PARTITION M204003 VALUES LESS THAN(UNIX_TIMESTAMP('2023/04/01'))
, PARTITION M204004 VALUES LESS THAN(UNIX_TIMESTAMP('2023/05/01'))
, PARTITION M204005 VALUES LESS THAN(UNIX_TIMESTAMP('2023/06/01'))
, PARTITION M204006 VALUES LESS THAN(UNIX_TIMESTAMP('2023/07/01'))
, PARTITION M204007 VALUES LESS THAN(UNIX_TIMESTAMP('2023/08/01'))
, PARTITION M204008 VALUES LESS THAN(UNIX_TIMESTAMP('2023/09/01'))
, PARTITION M204009 VALUES LESS THAN(UNIX_TIMESTAMP('2023/10/01'))
, PARTITION M204010 VALUES LESS THAN(UNIX_TIMESTAMP('2023/11/01'))
, PARTITION M204011 VALUES LESS THAN(UNIX_TIMESTAMP('2023/12/01'))
, PARTITION M204012 VALUES LESS THAN(UNIX_TIMESTAMP('2024/01/01'))
);