Set functions are aggregate functions (they return one value for groups of rows and therefore imply grouping of tables).
<set function> ::= COUNT '(' '*' ')' |
The return type of set functions follow these rules:
● COUNT: The return type is exact numeric with scale 0.
● AVG: The return type is approximate numeric.
● MIN, MAX, SUM: The return type is the type of the argument.
SELECT AVG(salary) FROM employees |
Average. This query determines the average salary of all employees.
SELECT COUNT(*) FROM employees |
COUNT(*). This query determines the number of employees.
SELECT COUNT(DISTINCT employee_name) FROM employees |
Average. This query determines the number of different names of the employees.