创建分区表+分区表的分类+创建散列分区表+查看散列分区表分区中的数据+创建列表分区表+查看列表分区表分区中的数据...
創建分區表
分區表的分類
范圍分區:對數據表的某個值的范圍進行分區,需要使用partition by range字句。
散列分區:
1通過hash算法均勻分布數據的一種分區類型。
2通過在I/O設備上進行散列分區,可以使得分區的大小一致。
3創建散列分區需要使用partition by hash字句。
列表分區:
1適用于分區列的值為非數字或者日期數據類型,并且分區列的取值范圍較少時使用。
舉例:成績表的科目列取值較少,就可以使用列表分區。
2需要使用partition by list字句。
3分區時,需要為每個分區指定取值列表,分區列的取值處于同一個列表中的行將被存儲到同一個分區中。
組合范圍散列分區:
組合范圍列表分區:
舉例
創建散列分區表
create table student_hash(
sno varchar2(10) ,
sname varchar2(20),
sage number(2),
score number(2)
)partition by hash(sno)–散列分區表
(
partition part1 tablespace myspace,
partition part2 tablespace users
);
insert into student_hash values(‘1’,’我叫分區1’,12,55);
insert into student_hash values(‘2’,’我叫分區1’,12,56);
insert into student_hash values(‘3’,’我叫分區2’,12,76);
insert into student_hash values(‘4’,’我叫分區3’,12,86);
查看散列分區表分區中的數據
select * from student_hash partition(part1);
select * from student_hash partition(part2);
創建列表分區表
create table student_list(
sno varchar2(10) ,
ssex varchar2(2),
sage number(2),
score number(2)
)partition by list(ssex)–列表分區表
(
partition part1 values(‘男’) tablespace myspace,
partition part2 values(‘女’) tablespace users
);
insert into student_list values(‘1’,’男’,12,55);
insert into student_list values(‘2’,’男’,12,56);
insert into student_list values(‘3’,’女’,12,76);
insert into student_list values(‘4’,’女’,12,86);
查看列表分區表分區中的數據
select * from student_list partition(part1);
select * from student_list partition(part2);
轉載于:https://www.cnblogs.com/feiZhou/p/9344281.html
總結
以上是生活随笔為你收集整理的创建分区表+分区表的分类+创建散列分区表+查看散列分区表分区中的数据+创建列表分区表+查看列表分区表分区中的数据...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 看完你就知道什么是 HTTPS 了
- 下一篇: Windows Server 2003