PostgreSQL has an ordered-set aggregate function called mode()
that allows us to get the mode from a given column.
The mode is the most frequently occurring value.
Null values are ignored, so if null
occurs the most, the mode()
function will return the second most common value.