count(1)与count(*)比较: 如果你的数据表没有主键,那么count(1)比count(*)快 如果有主键的话,那主键(联合主键)作为count的条件也比count(*)要快 如果你的表只有......
SQL> select count(sal) from test;
COUNT(SAL) ---------- 3
SQL> select count(distinct sal) from test;
COUNT(DISTINCTSAL) ------------------ 2
SQL> select distinct sal from test;
SAL ---------- 80 90
SQL> select count(distinct *) from test; select count(distinct *) from test * ERROR 位于第 1 行: ORA-00936: 缺少表达式
SQL> spool off
2/2 首页 上一页 1 2 |