Giv*_*Pie 4 sql oracle partitioning oracle10g
如何按范围划分:一个用于pubdate值小于2000年1月1日; 一个用于pubdate值大于或等于2000年1月1日且小于2010年1月1日; 以及所有pubdate值大于或等于2010年1月1日的第三个分区.
如何为分区部分编写查询?我试图查找示例,但我只是不明白分区后要放什么.
我的问题在这里:
CREATE table lab6_zl (
ID number not null,
title varchar2(40),
pubID char(3),
pubdate date,
constraint lab6_pk primary key(ID))
Partition by range (pubdate)
(Partition one for pubdate values greater than or equal to Jan 1, 2000),
(Partition two for for pubdate values less than Jan 1, 2000),
(Partition three for all pubdate values greater than or equal to Jan 1, 2010);
Run Code Online (Sandbox Code Playgroud)
试试这个:
create table LAB6_ZL
(
ID number not null
,TITLE varchar2(40)
,PUBID char(3)
,PUBDATE date
,constraint LAB6_PK primary key(ID)
)
partition by range (PUBDATE)
(partition TWO
values less than (date '2000-01-01')
,partition ONE
values less than (date '2010-01-01')
,partition THREE
values less than (MAXVALUE));
Run Code Online (Sandbox Code Playgroud)
分区的顺序必须是升序的,因此TWO首先创建分区,因为它小于2000年,ONE因此在2000年到2009年之间.关键字MAXVALUE基本上没有上限值,或者在2010年1月1日或之后的任何内容.
| 归档时间: |
|
| 查看次数: |
1727 次 |
| 最近记录: |