创建分区
--先声明一下:列表分区不支持多列,但是范围分区和哈希分区支持多列。
create table graderecord
-- 范围分区 根据列的值的范围
(
sno varchar2(10),
sname varchar2(20),
dormitory varchar2(3),
grade int)
partition by range(grade)(
partition fail values less than(60),
partition pass values less than(85),
partition excellent values less than(maxvalue)
)
select * from graderecord
select * from graderecord partition(fail)
-- 散列分区 根据字段的hash分布
partition by hash(sno)(
partition p1,
partition p2,
partition p3
)
-- 列表分区 根据列的值的具体值
partition by list(dormitory)(
partition d229 values('229'),
partition d228 values('228'),
partition d240 values('240')
)
-- 符合分区 范围分区和hash分区
partition by range(grade)
subpartition by hash(sno,sname)(
partition p1 values less than(75)
(
subpartition sp1,subpartition sp2
),
partition p2 values less than(maxvalue)
(
subpartition sp3,subpartition sp4
)
)
查看分区
select object_name,subobject_name from user_objects
where object_type = 'TABLE PARTITION'
删除分区,子分区
alter table [tbname] drop partition [ptname];
alter table [tbname] drop subpartition [ptname];
标签:less,分区,partition,values,oracle,subpartition,than From: https://blog.51cto.com/u_2465818/6209756