Loading…
FIRST_VALUE(column) returns the first value in the window:
FIRST_VALUE(name) OVER(PARTITION BY category ORDER BY price DESC)
This gets the name of the most expensive product in each category.
For each product, show:
category_leader)Order by category, then price descending.
Downloading SQL engine… (one-time)
This runs entirely in your browser and is cached for next time.