In DuckDB, arg_max()
is an aggregate function that finds the row with the maximum value in one column and returns the corresponding value from another column at that row. Rows where either of the first two arguments is NULL
 are ignored.
Let’s take a look at the arg_max()
with some straightforward examples.