SQL基础及案例分享


立即下载 不见你
2025-04-13
分享 select whe DBA 道森 学院 www.daosen orac le.com dual
989.4 KB

一线DBA分享
道森学院
www.daosenoracle.com
SQL基础知识及案例分享
飞雪
2015-7-9
QQ:2639140998
邮箱: 2639140998@qq.com
1
一线DBA分享
道森学院
www.daosenoracle.com
2
CONTENTS  了解ORACLE中null的特殊性
 正确使用null值
 案例分享
一线DBA分享
道森学院
www.daosenoracle.com
案例分享- null和索引
3
• 单列索引,如果这列可以为null,那么,索引列is null的时候,不会走索
引。
• 有null值的行,怎样才能走索引?
Structured Query Language
一线DBA分享
道森学院
www.daosenoracle.com
null是什么
4
• 当列没有值时,可以表示为null,另外,当列值未知或者无意义时也可以使用null
• 由于null表示数据是不确定的、未知的,所以null不能等于或者不等于任何值或者另一
个null。
select * from emp where comm=null;
select * from dual where null='';
select * from dual where null = null;
select * from dual where null != null;
select * from dual where null >= 0;
一线DBA分享
道森学院
www.daosenoracle.com
判断null值
5
• 判断列值是否为nulls,只能使用is null与is not null。
• 如果使用其他条件对nulls进行判断比较,得到的结果都是
UNKNOWN。
select * from emp where comm is null;
select * from emp where comm is not null;
一线DBA分享
道森学院
www.


分享/select/whe/DBA/道森/学院/www.daosen/orac/le.com/dual/ 分享/select/whe/DBA/道森/学院/www.daosen/orac/le.com/dual/
-1 条回复
登录 后才能参与评论
-->