- Categories:
Aggregate functions (General)
SKEW¶
Returns the sample skewness of non-NULL records. If all records inside a group are NULL, the function returns NULL.
The following formula is used to compute the sample skewness:
\[(n^2)/((n-1) * (n-2)) * (m_3/(k_2)^(1.5))\]
where:
\(n\) denotes the number of non-null records.
\(m_3\) denotes the sample third central moment.
\(k_2\) denotes the symmetric unbiased estimator of the variance.
Intuitively, skew describes how asymmetric the underlying distribution is.
Syntax¶
Arguments¶
exprThis is an expression that evaluates to a numeric data type (INTEGER, FLOAT, DECIMAL, etc.).
Returns¶
This function returns a value of type DOUBLE.
Usage notes¶
For inputs with fewer than three records, SKEW returns NULL.
Examples¶
Create a table and load the data:
Display the data:
Query the data: