ID VAL DATE_ENTERED --- ---- ------------ 1 100 01/01/05 2 110 01/02/05 3 110 01/03/05 4 111 01/05/05If I wanted to do list partitioning on the day of the week, I'd add another column to the table as follows:
ID VAL DATE_ENTERED WEEKDAY --- ---- ------------ ------- 1 100 01/01/05 SAT 2 110 01/02/05 SUN 3 110 01/03/05 MON 4 111 01/03/05 MONThe WEEKDAY column can be populated with a trigger, using the contents of the DATE_ENTERED column to determine the WEEKDAY column's value.
To create this table as a list partitioned table, you can use a command similar to the following:
CREATE TABLE my_table ( id NUMBER, val NUMBER, date_entered DATE, weekday CHAR(3)) PARTITION BY LIST (weekday) ( PARTITION my_table_sun VALUES ('SUN'), PARTITION my_table_mon VALUES ('MON'), PARTITION my_table_tue VALUES ('TUE'), PARTITION my_table_wed VALUES ('WED'), PARTITION my_table_thu VALUES ('THU'), PARTITION my_table_fri VALUES ('FRI'), PARTITION my_table_sat VALUES ('SAT'));
Dig deeper on Oracle database design and architecture
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.