- 在order 中,簡單把null認為是最大
- 與null的運算,返回null
SQL> select 1 + null from dual;
1+NULL
----------
- 與null的字符串合并,忽略null
SQL> select 'Hi'||null from dual;
'HI'||NULL
----------
Hi
- Null的查詢為is null
- Count(field),不包括null
- 如果索引條目全為null,則索引不記錄null
- In/not in與null
- Exists/not exists與null
SQL> select * from t1;
A B
---------- ----------
1 1
2
3
SQL> select * from t2;
A B
---------- ----------
1 1
2
SQL> select * from t1 where b in (select B from t2);
A B
---------- ----------
1 1
SQL> select * from t1 where b not in (select B from t2);
A B
---------- ----------
SQL> select * from t1 where exists (select * from t2 where t2.b = t1.b);
A B
---------- ----------
1 1
SQL> select * from t1 where not exists (select * from t2 where t2.b = t1.b);
A B
---------- ----------
3
2
exists主要用于片面的,有滿足一個條件的即可, 所以速度快很多. in 主要用于具體的集合操作, 有多少滿足條件.