Skip to content

Commit

Permalink
solvesql/난이도 4: 가구 판매의 비중이 높았던 날 찾기 (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
sieunnnn committed Feb 5, 2024
1 parent 630c23a commit 93676ec
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/solvesql/level4/PROB01.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
SELECT
order_date,
COUNT(
DISTINCT (
CASE
WHEN category = 'Furniture' THEN order_id
END
)
) AS 'furniture',
ROUND(
COUNT(
DISTINCT (
CASE
WHEN category = 'Furniture' THEN order_id
END
)
) * 100.0 / COUNT(DISTINCT order_id),
2
) AS 'furniture_pct'
FROM
records
GROUP BY
order_date
HAVING
COUNT(DISTINCT order_id) >= 10
AND furniture_pct >= 40
ORDER BY
furniture_pct DESC,
order_date

0 comments on commit 93676ec

Please sign in to comment.