ComeçarComece de graça

Revenue per week

Delivr's first full month of operations was June 2018. At launch, the Marketing team ran an ad campaign on popular food channels on TV, with the number of ads increasing each week through the end of the month. The Head of Marketing asks you to help her assess that campaign's success.

Get the revenue per week for each week in June and check whether there's any consistent growth in revenue.

Note: Don't be surprised if you get a date in May in the result. DATE_TRUNC('week', '2018-06-02') returns '2018-05-28', since '2018-06-02' is a Saturday and the preceding Monday is on '2018-05-28'.

Este exercício faz parte do curso

Analyzing Business Data in SQL

Ver curso

Instruções do exercício

  • Write the expression for revenue.
  • Keep only the records of June 2018.

Exercício interativo prático

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

SELECT DATE_TRUNC('week', order_date) :: DATE AS delivr_week,
       -- Calculate revenue
       ___ AS revenue
  FROM meals
  JOIN orders ON meals.meal_id = orders.meal_id
-- Keep only the records in June 2018
WHERE ___
GROUP BY delivr_week
ORDER BY delivr_week ASC;
Editar e executar o código