文章目录
注意:不支持字符串之间的运算操作,字符串相关操作需要借助单列函数完成。
1. 关系运算符
每个关系运算符都返回 boolean 类型结果:
注意:判断字段值是否为
null
,不能用=
或者!=
,只能用col is null
或col is not null
1.1 is not null
--is null空值判断
select 1 from dual where 'itcast' is null; -- 返回0条数据
--is not null 非空值判断
select 1 from dual where 'itcast' is not null; -- 返回一条数据,且数值为1
1.2 like
like比较: _
表示任意单个字符, %
表示任意数量字符。
select 1 from dual where 'itcast' like 'it_'; -- 返回0条数据1
select 1 from dual where 'itcast' like 'it%'; -- 返回一条数据,且数值为
-- not...like 中的not 可以放在like前;也可以放在where后。下面两条语句等价:
select 1 from dual where 'itcast' not like 'hadoo_';
select 1 from dual where