SELECT
  item,
  RANK() OVER (PARTITION BY category ORDER BY purchases DESC) as rank
FROM Produce
WHERE Produce.category = 'vegetable'
QUALIFY rank <= 3
--------------------
SELECT item, RANK() OVER (PARTITION BY category ORDER BY purchases DESC) AS rank
FROM Produce
WHERE Produce.category = 'vegetable'
QUALIFY rank <= 3
------------------------------------------------------------------------------------------------------------------------
SELECT item
FROM Produce
WHERE Produce.category = 'vegetable'
QUALIFY RANK() OVER (PARTITION BY category ORDER BY purchases DESC) <= 3
--------------------
SELECT item
FROM Produce
WHERE Produce.category = 'vegetable'
QUALIFY RANK() OVER (PARTITION BY category ORDER BY purchases DESC) <= 3