oracle分表sql,Oracle数据库 表分区

Oracle表分区分为四种:范围分区,散列分区,列表分区和复合分区。

一:范围分区

Sql代码

create table graderecord

(

sno varchar2(10),

sname varchar2(20),

dormitory varchar2(3),

grade int

)

partition by range(grade)

(

partition bujige values less than(60), --不及格

partition jige values less than(85), --及格

partition youxiu values less than(maxvalue) --优秀

)

插入实验数据:

insert into graderecord values('511601','魁','229',92);

insert into graderecord values('511602','凯','229',62);

insert into graderecord values('511603','东','229',26);

insert into graderecord values('511604','亮','228',77);

insert into graderecord values('511605','敬','228',47);

insert into graderecord(sno,sname,dormitory) values('511606','峰','228');

insert into graderecord values('511607','明','240',90);

insert into graderecord values('511608','楠','240',100);

insert into graderecord values('511609','涛','240',67);

insert into graderecord values('511610','博','240',75);

insert into graderecord values('511611','铮','240',60);

下面查询一下全部数据,然后查询各个分区数据,代码一起写:

select * from graderecord;

select * from graderecord partition(bujige);

select * from graderecord partition(jige);

select * from graderecord partition(youxiu);

全部数据如下:

11.jpg

不及格数据如下:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值