首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

只对表中的某些值建立目录

2012-08-17 
只对表中的某些值建立索引建表create table z (id number primary key, processed_flag varchar2(1), payl

只对表中的某些值建立索引
建表

create table z
(id number primary key,
processed_flag varchar2(1),
payload varchar2(20)
)

processed_flag 只有两种值 'Y' or 'N'

只需要对该列的'N'值建索引

create index t_idx on z( decode(processed_flag, 'N', 'N'))

因为decode语法 DECODE(value, if1, then1, if2,then2, if3,then3, . . . else )

当值为'N'时返回'N',非'N'时返回NULL,某人的B*树索引不为NULL值做键

热点排行