BaşlayınÜcretsiz Başlayın

Histogram of revenue

After determining that Delivr is doing well at scaling its business model, Dave wants to explore the distribution of revenues. He wants to see whether the distribution is U-shaped or normal to see how best to categorize users by the revenue they generate.

Send Dave a frequency table of revenues by user.

Bu egzersiz

Analyzing Business Data in SQL

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Store each user ID and the revenue Delivr generates from it in the user_revenues CTE.
  • Return a frequency table of revenues rounded to the nearest hundred and the users generating those revenues.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

WITH user_revenues AS (
  SELECT
    -- Select the user ID and revenue
    ___,
    ___ AS revenue
  FROM meals AS m
  JOIN orders AS o ON m.meal_id = o.meal_id
  GROUP BY user_id)

SELECT
  -- Return the frequency table of revenues by user
  ___ AS revenue_100,
  ___ AS users
FROM user_revenues
GROUP BY revenue_100
ORDER BY revenue_100 ASC;
Kodu Düzenle ve Çalıştır