Example: PARTITION BY LIST v17
This example creates a partitioned table sales
using the PARTITION BY LIST
clause. The sales
table stores information in three partitions: europe
, asia
, and americas
.
CREATE TABLE sales ( dept_no number, part_no varchar2, country varchar2(20), date date, amount number ) PARTITION BY LIST(country) ( PARTITION europe VALUES('FRANCE', 'ITALY'), PARTITION asia VALUES('INDIA', 'PAKISTAN'), PARTITION americas VALUES('US', 'CANADA') );
The resulting table is partitioned by the value specified in the country
column:
edb=# SELECT partition_name, high_value from ALL_TAB_PARTITIONS;
Output
partition_name | high_value ----------------+--------------------- EUROPE | 'FRANCE', 'ITALY' ASIA | 'INDIA', 'PAKISTAN' AMERICAS | 'US', 'CANADA' (3 rows)
- Rows with a value of
FRANCE
orITALY
in thecountry
column are stored in theeurope
partition. - Rows with a value of
INDIA
orPAKISTAN
in thecountry
column are stored in theasia
partition. - Rows with a value of
US
orCANADA
in thecountry
column are stored in theamericas
partition.
The server evaluates the following statement against the partitioning rules and stores the row in the europe
partition:
INSERT INTO sales VALUES (10, '9519a', 'FRANCE', '18-Aug-2012', '650000');