SQL> select empno,comm from scott.emp;EMPNO COMM
----- ---------
7369
7499 300.00
7521 500.00
7566
7654 1400.00
7698
7782
7788
7839
7844 0.00
7876
7900
7902
7934 14 rows selectedSQL> select empno,comm from scott.emp where comm like '%%';EMPNO COMM
----- ---------
7499 300.00
7521 500.00
7654 1400.00
7844 0.00
----- ---------
7369
7499 300.00
7521 500.00
7566
7654 1400.00
7698
7782
7788
7839
7844 0.00
7876
7900
7902
7934 14 rows selectedSQL> select empno,comm from scott.emp where comm like '%%';EMPNO COMM
----- ---------
7499 300.00
7521 500.00
7654 1400.00
7844 0.00
18:57:04 SQL> desc t1;
名称 是否为空? 类型
----------------------------------------- -------- ---------------------------- A NUMBER(38)
B VARCHAR2(10)18:57:10 SQL> select * from t1; A B
---------- ----------
1 a
1 dfd
2 a2
3
4
5 34ad已选择6行。已用时间: 00: 00: 00.00
18:57:14 SQL> select * from t1 where b like '%'; A B
---------- ----------
1 a
1 dfd
2 a2
5 34ad已用时间: 00: 00: 00.00
18:57:17 SQL> select * from t1 where b like '%' or b is null; A B
---------- ----------
1 a
1 dfd
2 a2
3
4
5 34ad已选择6行。已用时间: 00: 00: 00.00
18:57:20 SQL> select * from t1 where nvl(b,1) like '%'; A B
---------- ----------
1 a
1 dfd
2 a2
3
4
5 34ad已选择6行。已用时间: 00: 00: 00.00
select * from t1 where b like '%' or b is null
select * from t1
上面三个等效,都是显示所有记录。
select * from t1 where b like '%'
显示所有值的记录
----------
A
A
A
C
c
d
e已选择11行。已用时间: 00: 00: 00.4709:26:21 SQL> select col1 from tb where col1 like '%';COL1
----------
A
A
A
C
c
d
e已选择7行。已用时间: 00: 00: 00.63
09:26:39 SQL> select col1 from tb where col1 like '%' or col1 is null;COL1
----------
A
A
A
C
c
d
e已选择11行。已用时间: 00: 00: 00.47
09:26:49 SQL>