Skip to main content

Overview

MODE() is an ordered-set aggregate function that returns the most frequently occurring value (the mode) from a set of values.

Syntax

Null values are ignored during the calculation. If null is the most frequent value, the function will return the second most common value.

Parameters

  • (): this function takes no parameters, but empty parentheses is required

Example

For the needs of this section we will use a simplified version of the film table from the Pagila database, that will contain only the title, length and rating columns.
The query below retrieves the most frequent ratings found in the film table:
By executing the code above we will get the following output: