CommencerCommencer gratuitement

Registrations running total

You have a suggestion for Bob's pitch deck: Instead of showing registrations by month in the line chart, he can show the registrations running total by month. The numbers are bigger that way, and investors always love bigger numbers! He agrees, and you begin to work on a query that returns a table of the registrations running total by month.

Cet exercice fait partie du cours

Analyzing Business Data in SQL

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

WITH reg_dates AS (
  SELECT
    user_id,
    MIN(order_date) AS reg_date
  FROM orders
  GROUP BY user_id)

SELECT
  -- Select the month and the registrations
  ___ :: DATE AS delivr_month,
  ___ AS regs
FROM reg_dates
GROUP BY delivr_month
-- Order by month in ascending order
ORDER BY ___; 
Modifier et exécuter le code