Home >> Oracle >> APPROX_COUNT_DISTINCT() Aggregate function in Oracle

APPROX_COUNT_DISTINCT() Aggregate function in Oracle

APPROX_COUNT_DISTINCT() aggregate function returns the approximate number of rows that contain distinct values.

Note:-This aggregate function is altenative of COUNT.

APPROX_COUNT_DISTINCT() ignores rows that contain a null value. 

APPROX_COUNT_DISTINCT() aggregate function returns a NUMBER.

Syntax

APPROX_COUNT_DISTINCT(expression)

Example

SELECT APPROX_COUNT_DISTINCT(student_id) AS "active_student" FROM students;

Output

active_student
50

Post Your Comment

Next Questions
AVG() aggregate function
COLLECT() Aggregate Function
CORR() Aggregate Function
CORR_*
COUNT() aggregate function
COVAR_POP Aggregate Function
COVAR_SAMP() Aggregate Function
CUME_DIST() Aggregate Function
DENSE_RANK() Aggregate Function
FIRST() aggregate function
GROUP_ID() Aggregate Function
GROUPING() Aggregate Function
GROUPING_ID() Aggregate Function
LAST() aggregate function
LISTAGG() Aggregate Function
MAX() aggregate function
MEDIAN() Aggregate Function
MIN() Aggregate Function
PERCENT_RANK() Aggregate Function
PERCENTILE_CONT() Aggregate Function
PERCENTILE_DISC() Aggregate Function
RANK() Aggregate Function
REGR_() Aggregate Function
STATS_BINOMIAL_TEST() Aggregate Function
STATS_CROSSTAB() Aggregate Function

Copyright ©2022 coderraj.com. All Rights Reserved.