Partitioning Tables
Table partitioning divides a large table into smaller, manageable pieces for better performance and maintainability.
CREATE TABLE sales_partitioned ( sale_id INT, sale_date DATE, amount DECIMAL(10, 2) ) PARTITION BY RANGE (YEAR(sale_date)) ( PARTITION p2023 VALUES LESS THAN (2024), PARTITION p2024 VALUES LESS THAN (2025) );