高级数据过滤(like)

单字符过滤 '_'

select * from T_Employee where FName like  '_erry'

多字符过滤 '%'

select * from T_Employee where FName like  'T%'

 

集合匹配过滤 [jt] :第一个字母为J 或t的信息

                  [^jt] 反集合: 第一个字母不为J 或T 的信息

select * from T_Employee where FName like'[jt]%'

select * from T_Employee where FName  like '[^jt]%'

 

SQL中查询空值, 不能直接使用普通的等于来判断, 要使用关键字'is null / is not null ',因为数据库中一些特殊的设定会查询不到

select * from T_Employee where FAge is null
select * from T_Employee where FAge is not null and FSalary>2000

反运算符 ' != 不等于 !< 不小于  ' 等  三种表达方式 '!'符只能在SqlServer DB2 数据库中 使用

select * from  T_Employee where FAge!=23 and FSalary!<5000
select * from T_Employee where FAge<>23 and FSalary>=5000
select * from T_Employee where not(FAge=23) and not(FSalary<5000)  not 反运算

 

posted @ 2017-01-05 12:49  不忘初心de博客  阅读(381)  评论(0编辑  收藏  举报