oracle的分区表

1. 范围分区
create table dept
(deptno number(12),
deptname varchar2(30))
partition by range(deptno)
(
partition d1 values less than (10) tablespace dept1,
partition d2 values less than (20) tablespace dept2,
partition d3 values less than (maxvalue) tablespace dept3
)

2. 多列范围分区
create table cust_sales
(acc_no number(5),
deptname char(30),
item_id number(9),
sale_day integer not null,
sale_mth integer not null,
sale_yr  integer not null
)
partition by range(sale_yr,sale_mth,sale_day)
(
partition cust_sales_q1 values less than (2011,04,01) tablespace users,
partition cust_sales_q2 values less than (2011,07,01) tablespace users2,
partition cust_sales_q3 values less than (2011,10,01) tablespace users,
partition cust_sales_q4 values less than (2012,01,01) tablespace users2,
partition cust_sales_qx values less than (maxvalue,maxvalue,maxvalue) tablespace users2
);

3. 散列分区
create table cust_sales_hash
(
acct_no number(5),
cust_name char(30),
sale_day integer not null,
sale_mth integer not null,
sale_yr ?integer not null
)
partition by hash(acct_no)
partitions 4
store in (users1,users2,users3,users4);

4. 组合分区
create table orders
(
ordid number,
acct_no number(5),
cust_name char(30),
orderdate date,
productid number
)
partition by range(orderdate)
    subpartition by hash(productid) subpartitions 8
(
partition q1 values less than (to_date('01-APR-2011','dd-mon-yyyy'))  ,
partition q2 values less than (to_date('01-JUL-2011','dd-mon-yyyy'))  ,
partition q3 values less than (to_date('01-OCT-2011','dd-mon-yyyy'))  ,
partition q4 values less than (maxvalue)  
);

5. 列表分区
create table dept_part
(
dept_no number,
dname   varchar2(14),
loc     varchar2(13)
)
partition by list(dname)
(
partition d1_east values  ('BOSTION','NEW YORK')  ,
partition d2_east values  ('SAN FRANCISCO','log angeles')  ,
partition d3_east values  ('ATLANTA','DALLAS') ,
partition d4_east values  ('CHICAGO','detroit')  
);

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

请叫我曾阿牛

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值