在我们不知道具体有什么数据的时候,也即未知,可以用NULL,ORACLE中,含有空值的表列长度为零。 既然它表示未知的, 那么用一般的比较运算符= < >无法进行判断, 只能用 is or is not来表示
null 是未知状态,null不能用=与 <> 进行判断 只能用is null或is not null
<> 就是 != null需要用is null ,is not null来 判断
那么 orcale 中 is not null 与 <> ‘’ 的区别呢?
SQL> create table t(a int);表已创建。SQL> insert into t values (1);已创建 1 行。SQL> insert into t values (null);已创建 1 行。SQL> insert into t values (2);已创建 1 行。SQL> select * from t where a is not null; A ---------- 1 2SQL> select * from t where a<>'';未选定行
既然它表示未知的, 那么用一般的比较运算符= < >无法进行判断,
只能用 is or is not来表示
null需要用is null ,is not null来 判断
----------
1
2SQL> select * from t where a<>'';未选定行