ComeçarComece de graça

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.

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.

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 ___; 
Editar e executar o código