Skip to content

Commit

Permalink
solvesql/난이도 3: 쇼핑몰의 일일 매출액과 ARPPU (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
sieunnnn committed Jan 26, 2024
1 parent 901b6f9 commit e9ab64c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/solvesql/level3/PROB05.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
SELECT
DATE(D.order_purchase_timestamp) AS 'dt',
COUNT(DISTINCT D.order_id) AS 'pu',
SUM(O.payment_value) AS 'revenue_daily',
ROUND(
SUM(O.payment_value) / COUNT(DISTINCT D.order_id),
2
) AS 'arppu'
FROM
olist_orders_dataset AS D
JOIN olist_order_payments_dataset AS O ON D.order_id = O.order_id
WHERE
DATE(D.order_purchase_timestamp) >= '2018-01-01'
GROUP BY
DATE(D.order_purchase_timestamp)
ORDER BY
DATE(D.order_purchase_timestamp)

0 comments on commit e9ab64c

Please sign in to comment.