Note:
The APPROX_COUNT_DISTINCT
function is available starting with Oracle Database 12c Release 1 (12.1.0.2).
用例:
求scott.emp表中一共有多少个部门
11g:
SELECT COUNT(DISTINCT deptno) AS cnt FROM scott.emp
12c:
SELECT APPROX_COUNT_DISTINCT(deptno) AS cnt FROM scott.emp