Group Functions Flashcards
Which group functions will consider NULL values?
COUNT(*) and GROUPING
Can custom functions work on grouped data?
No
If no GROUP BY clause is specified, the default grouping becomes ____
The entire result set
What can be used as arguments for ORDER BY
the identifier or the column position (number)
AVG
AVG([{DISTINCT | ALL}] n) where n is a numeric expression to be evaluated.
COUNT
COUNT({* | [DISTINCT | ALL] })
If DISTINCT not specified, defaults to ALL
* counts all rows in result set, including NULL
MAX
MAX([{DISTINCT | ALL}] )
Can be datetime, numeric or character.
Character returns highest based on character set.
MIN
MIN([{DISTINCT | ALL}] )
Can be datetime, numeric or character.
Character returns highest based on character set.
SUM
SUM([{DISTINCT | ALL}] )
MEDIAN
MEDIAN() Returns middle value of result set.
STDDEV
STDDEV([{DISTINCT | ALL}] ) Returns standard deviation of result set.
VARIANCE
VARIANCE([{DISTINCT | ALL}] ) Returns numerical variance of result set.
LISTAGG
LISTAGG( [col_name, ‘, ‘]) WITHIN GROUP ( ORDER BY )
Aggregates data from multiple rows into one row per group.
CORR
CORR(y, x) Returns coefficient of the correlation of a set of number pairs.
COVAR_POP
COVAR_POP(y, x) Returns population covariance of a set of number pairs. Covariance can return NULL.