Menu
easyFoodpanda · window

Rank grocery items by price within each category

A grocery listing table holds items with their category and price. The merchandising team wants to see, within each category, which item is the most expensive, second most expensive, and so on — with tied prices sharing the same rank.

Return category, item_name, price and price_rank, ordered by category then price_rank.

Schema

grocery_items
item_idINT
item_nameTEXT
categoryTEXT
priceNUMERIC

Example input

grocery_items
↑ Read the question

Keep going

Company names are trademarks of their respective owners, used here only to describe practice material. mahir_data is not affiliated with, endorsed by, or sponsored by any company named on this site. Terms.