Aggregation functions
------------------------------------------aggregate function---------------------------------------------
--1:avg (distinct| All)
All means that all values are averaged, and distinct only averages the different values.
SELECT AVG (SAL) from SCOTT. EMP;
SELECT AVG (DISTINCT SAL) from SCOTT. EMP;
--2:max (distinct| All)
The maximum value, all represents the maximum value for all values, distinct represents the maximum value for the different values, the same only once
(plus no query results consistent, I do not know what the use of distinct, unlike the AVG and other aggregation functions)
SELECT MAX (DISTINCT SAL) from SCOTT. EMP;
SELECT MAX (SAL) from SCOTT. Emp
--3:min (distinct| All)
The minimum value, all means the minimum value for all values, distinct represents the minimum value for different values, the same only once
SELECT MIN (SAL) from SCOTT. EMP;
SELECT MIN (DISTINCT SAL) from SCOTT. EMP;
--4:stddev (Distinct|all)
Standard deviation, all means a standard deviation for all values, distinct means only the standard deviation for different values
SELECT STDDEV (SAL) from SCOTT. EMP;
SELECT STDDEV (DISTINCT SAL) from SCOTT. EMP;
--5:variance (distinct| All)
Covariance all means that all values are covariance, distinct means that only different values are evaluated for covariance
SELECT VARIANCE (SAL) from SCOTT. EMP;
SELECT VARIANCE (DISTINCT SAL) from SCOTT. EMP;
--6:sum (distinct| All)
Sum all means summing all values, distinct means summing only different values (the same value is only taken once)
SELECT SUM (SAL) from SCOTT. EMP;
SELECT SUM (DISTINCT SAL) from SCOTT. EMP;
--7:count (distinct| All)
The number of records and data. All records, arrays are counted, distinct only for the different values (the same value is only taken once)
SELECT COUNT (SAL) from SCOTT. EMP;
SELECT COUNT (DISTINCT SAL) from SCOTT. EMP;
----8:median
To find the median number
SELECT MEDIAN (SAL) from SCOTT. EMP;
SELECT MEDIAN (DISTINCT SAL) from SCOTT. EMP; --Error: The DISTINCT option is disabled in this function.
----------------------------------------------------------------------------------------------
Aggregate functions of Oracle Common functions