-- MySQL 5.6
select sname,tname,pname,position,method,expression
from (
select if (table_schema=@sname...partition_name is not null
order by table_schema,table_name,partition_ordinal_position desc) t where rn=0;
-- MySQL...order by sname,pname,position,tname;
-- 生成按天分区
select concat('partition p',adddate('2020-12-31',id...)+0,' VALUES LESS THAN (',adddate('2020-12-31',id+1)+0,'),') from nums limit 365;