MODE
Description
This function finds the most frequent elements per group. Mode can be applied on any data type. For multi-modal input, where there are several result candidates, the element with the smallest value is chosen. For elements of type STRING, the smallest value is determined by its lexicographical order.
Syntax
MODE ( table.column )
NULL handling
NULL values are ignored. If all the values of a group are NULL, the result for this group is NULL.
Examples
[1] Find the most frequent value in a column of integers. | ||||||||||||
| ||||||||||||
|
[2] Find the most frequent value by country. | ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
|
[3] Find the most frequent value in a multi-modal table. | |||||||||||
| |||||||||||
|