2024年04月16日 建站教程
//创建分区表 CREATE TABLE orders ( id INT PRIMARY KEY AUTO_INCREMENT, order_no VARCHAR(20), order_date DATE ) PARTITION BY RANGE (YEAR(order_date)) ( PARTITION p0 VALUES LESS THAN (2020), PARTITION p1 VALUES LESS THAN (2021), PARTITION p2 VALUES LESS THAN (2022), PARTITION p3 VALUES LESS THAN (2023), PARTITION p4 VALUES LESS THAN MAXVALUE ); //查询分区表 SELECT * FROM orders PARTITION (p1) WHERE YEAR(order_date) = 2022;
本文链接:http://so.lmcjl.com/news/2305/