Oracle9i通过引入列表分区(List Partition),使得当前共有4种分区数据的方法,具体列出如下:
第一种 范围分区
1 对表进行单列的范围分区:
这使最为常用也是最简单的方法,具体例子如下:
create table emp
(empno number(4),
ename varchar2(30),
sal number)
partition by range(empno)
(partition e1 s less than (1000) tablespace emp1,
partition e2 s less than (2000) tablespace emp2,
partition e3 s less than (max) tablespace emp3);
insert into emp s (100,Tom,1000);
insert into emp s (500,Peter,2000);
insert into emp s (1000,Scott,3000);
insert into emp s (1999,Bill,4000);
insert into emp s (5000,Gates,6000);
commit;
从emp表中选择全部的纪录如下:
SQL> select * from emp;
EMPNO ENAME SAL
---------- ------------------------------ ----------
100 Tom 1000
500 Peter 2000
1000 Scott 3000
1999 Bill 4000
5000 Gates 6000
还可以按照分区进行选择:
SQL> select * from emp partition (e1);
EMPNO ENAME SAL
---------- ------------------------------ ----------
100 Tom 1000
500 Peter 2000
SQL> select * from emp partition (e2)
EMPNO ENAME SAL
---------- ------------------------------ ----------
1000 Scott 3000