From 4187f9d49a78cf42dac42dae2499bba696e86c9d Mon Sep 17 00:00:00 2001 From: Bothinath <110240795+Bothinath-B@users.noreply.github.com> Date: Fri, 14 Feb 2025 19:28:16 +0530 Subject: [PATCH] Update 23.partition Some changes in Sub_Partition Example --- 23.partition | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/23.partition b/23.partition index 3848afa..6fd5745 100644 --- a/23.partition +++ b/23.partition @@ -111,17 +111,18 @@ Sub Partition ------------- CREATE TABLE orders ( - order_id INT AUTO_INCREMENT PRIMARY KEY, + order_id INT AUTO_INCREMENT, order_date DATE NOT NULL, customer_name VARCHAR(50), - amount DECIMAL(10,2) + amount DECIMAL(10,2), + primary key(order_id,order_date) --order-date need to be primary key ) -- Range partition by YEAR(order_date) PARTITION BY RANGE (YEAR(order_date)) -- Subpartition by HASH on MONTH(order_date) SUBPARTITION BY HASH (MONTH(order_date)) -- We want 3 top-level (range) partitions -PARTITIONS 3 +-- PARTITIONS 3 # this line shows error in MySQL -- Each partition splits into 2 subpartitions SUBPARTITIONS 2 (