Example - PARTITION BY RANGE v13
The following example creates a partitioned table (sales)
using the PARTITION BY RANGE
clause. The sales
table stores information in four partitions (q1_2012, q2_2012, q3_2012
and q4_2012)
.
The resulting table is partitioned by the value specified in the date
column.
- Any row with a value in the
date
column before April 1, 2012 is stored in a partition namedq1_2012
. - Any row with a value in the
date
column before July 1, 2012 is stored in a partition namedq2_2012
. - Any row with a value in the
date
column before October 1, 2012 is stored in a partition namedq3_2012
. - Any row with a value in the
date
column before January 1, 2013 is stored in a partition namedq4_2012
.
The server would evaluate the following statement against the partitioning rules and store the row in the q3_2012
partition.
INSERT INTO sales VALUES (10, '9519a', 'FRANCE', '18-Aug-2012', '650000');