Oracle 10g Range Partition Query

How can I split into a range for: one for pubdate values ​​less than January 1, 2000; one for values ​​for public announcements greater than or equal to January 1, 2000 and less than January 1, 2010; and the third section for all pubdate values ​​that are greater than or equal to January 1, 2010

How can I write my request for part of a section? I tried to find examples, but I just do not understand what to put after the section.

My request is here:

CREATE table lab6_zl ( ID number not null, title varchar2(40), pubID char(3), pubdate date, constraint lab6_pk primary key(ID)) Partition by range (pubdate) (Partition one for pubdate values greater than or equal to Jan 1, 2000), (Partition two for for pubdate values less than Jan 1, 2000), (Partition three for all pubdate values greater than or equal to Jan 1, 2010); 
+4
source share
1 answer

Try the following:

 create table LAB6_ZL ( ID number not null ,TITLE varchar2(40) ,PUBID char(3) ,PUBDATE date ,constraint LAB6_PK primary key(ID) ) partition by range (PUBDATE) (partition TWO values less than (date '2000-01-01') ,partition ONE values less than (date '2010-01-01') ,partition THREE values less than (MAXVALUE)); 

The order of the partitions should be incremental, therefore, the TWO partition is created first, since it is less than 2000, while ONE therefore between 2000 and 2009. The keyword MAXVALUE basically means that there is no upper value, or anything since January 1, 2010 or after.

+5
source

Source: https://habr.com/ru/post/1398108/


All Articles