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.
Cet exercice fait partie du cours
Analyzing Business Data in SQL
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
SELECT
user_id,
COUNT(DISTINCT order_id) AS count_orders
FROM orders
-- Only keep orders in August 2018
WHERE ___
GROUP BY user_id;