--列表分割槽create table student(
sid number,
sname varchar2(20),
province varchar2(20)
)partition by list(province)(
partition north values('河南','安徽','河北','山東'),
partition south values('廣東','海南','廣西','江西'),
partition west values('新疆','青海','寧夏','山西'),
partition east values('上海','浙江','江蘇'),
partition p1 values('湖北','湖南','重慶','四川')
)insert into student (sid,sname,province)values(1,'wenwen','河南');
insert into student (sid,sname,province)values(2,'hehe','河北');
insert into student (sid,sname,province)values(3,'qiuqiu','河南');
insert into student (sid,sname,province)values(4,'tuanzi','重慶');
insert into student (sid,sname,province)values(5,'yaoguai','湖南');
insert into student (sid,sname,province)values(6,'方圓','青海');
insert into student (sid,sname,province)values(7,'娥娥','海南');
insert into student (sid,sname,province)values(8,'哥哥','河南');
select * from student partition(north);
--復合分割槽--先按成績範圍分割槽 0-60, 60-80 雜湊分割槽
create table grades(
sno number,
sname varchar2(20),
grade number
)partition by range(grade)
subpartition by hash(sno,sname)
( partition p1 values less than (60)(
subpartition sp1,
subpartition sp2
),partition p2 values less than (80)(
subpartition sp3,
subpartition sp4
));insert into grades(sno,sname,grade)values(1,'wenwen',70);
insert into grades(sno,sname,grade)values(2,'huahua',70);
insert into grades(sno,sname,grade)values(3,'baibai',30);
insert into grades(sno,sname,grade)values(4,'hehe',59);
insert into grades(sno,sname,grade)values(5,'jiayou',57);
insert into grades(sno,sname,grade)values(6,'keai',29);
insert into grades(sno,sname,grade)values(7,'bajie',60);
insert into grades(sno,sname,grade)values(8,'jiujiu',70);
insert into grades(sno,sname,grade)values(9,'wowo',37);
insert into grades(sno,sname,grade)values(10,'haha',78);
insert into grades(sno,sname,grade)values(11,'dudu',54);
insert into grades(sno,sname,grade)values(12,'heihei',70);
insert into grades(sno,sname,grade)values(13,'eee',64);
--insert into grades(sno,sname,grade)values(14,'manman',99);
select * from grades;
select * from grades partition(p1);
select * from grades partition(p2);
--查詢子分割槽的資訊select * from grades subpartition(sp1);
select * from grades subpartition(sp2);
--查詢當前使用者所有的表分割槽資訊
select * from user_tab_partitions;
--查詢子分割槽資訊
select * from user_tab_subpartitions;
--發現值沒有對應的範圍分割槽 新增乙個分割槽
alter table grades add partition p3 values less than (100);
alter table grades add partition p4 values less than (maxvalue);
--分割槽裡面沒有值 需要刪除此分割槽
alter table grades drop partition p4;
--分割槽裡面的資料沒有意義,不刪除分割槽,只刪除資料
alter table grades truncate partition p3;
Oracle 復合分割槽
create table wzw sales acct no number 5 person varchar2 30 sales amount number 8 week no number 2 partition by range week no subpartition by list acct...
Oracle 表分割槽 復合分割槽
oracle表分割槽 範圍分割槽 oracle.表分割槽 雜湊分割槽 oracle.表分割槽 列表分割槽 oracle.表分割槽 復合分割槽 oracle表分割槽 操縱已分割槽的表 範圍分割槽與雜湊分割槽或列表分割槽的組合 語法 partition by range column name1 sub...
oracle復合分割槽型別
在 10g 中,復合分割槽只支援 range list 和 range hash,而在在 11g 中復合分割槽的型別大大增加,現在 range,list,interval 都可以作為 top level 分割槽,而 second level 則可以是 range,list,hash,也就是在 11g...