create table test1 (a varchar2(2),b varchar2(2)); insert into test1 values ('b','c'); insert into test1 values ('c','e'); insert into test1 values (null,'c'); insert into test1 values ('e',null);
首先他们通过查询计划效率是一样的,其次他们查到的数据也是一样的。
例子:
SQL> select count(*) from test1; COUNT(*) ---------- 4 SQL> select count(1) from test1; COUNT(1) ---------- 4 SQL> select count(a) from test1; COUNT(A) ---------- 3 SQL> select count(b) from test1; COUNT(B) ---------- 3
count(1) 也是不是去除null值得,只有具体的列,才去null值。