ComeçarComece de graça

Rank users by their count of orders

Eve tells you that she wants to report which user IDs have the most orders each month. She doesn't want to display long numbers, which will only distract C-level execs, so she wants to display only their ranks. The top 1 rank goes to the user with the most orders, the second-top 2 rank goes to the user with the second-most orders, and so on.

Send Eve a list of the top 3 user IDs by orders in August 2018 with their ranks.

Este exercício faz parte do curso

Analyzing Business Data in SQL

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

SELECT
  user_id,
  COUNT(DISTINCT order_id) AS count_orders
FROM orders
-- Only keep orders in August 2018
WHERE ___
GROUP BY user_id;
Editar e executar o código