The following example creates a table partitioned with orders data for each quarter in 2008.
CREATE TABLE Orders (O_orderkey INTEGER NOT NULL, O_custkey INTEGER, O_orderperiod PERIOD (DATE) NOT NULL, O_orderpriority CHAR (21), O_comment VARCHAR (79)) PRIMARY INDEX (O_orderkey) PARTITION BY CASE_N (END (O_orderperiod) <= date'2008-03-31', /* First Quarter */ END (O_orderperiod) <= date'2008-06-30', /* Second Quarter */ END (O_orderperiod) <= date'2008-09-30', /* Third Quarter */ END (O_orderperiod) <= date'2008-12-31' /* Fourth Quarter */ );
The following SELECT statement scans two partitions and displays the details of the orders placed for the first two quarters.
SELECT * FROM Orders WHERE END (O_orderperiod) > date'2008-06-30';