Skip to content

Commit 1914ecc

Browse files
committed
Solvesql Solution
- SQL
1 parent fc8562c commit 1914ecc

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

Solvesql/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,17 @@
3232

3333
</details>
3434

35+
<br />
36+
<br />
37+
38+
## 난이도 3
39+
40+
<details open> <summary> 접기 / 펼치기 </summary>
41+
42+
| Idx | Question | Category | Solution | Note |
43+
|:---:|-------------------------------------------------------| -------------------------------------------------------------------------- |-------------------------------------------------------------------------------------------------------------| ---- |
44+
45+
</details>
46+
3547
<br />
3648
<br />
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- @ss.idx: 2
2+
-- @ss.level: 3
3+
-- @ss.title: 할부는 몇 개월로 해드릴까요
4+
-- @ss.slug: installment-month
5+
-- @ss.category: Aggregate
6+
-- @ss.note:
7+
8+
SELECT payment_installments
9+
, COUNT(DISTINCT order_id) AS order_count
10+
, MIN(payment_value) AS min_value
11+
, MAX(payment_value) AS max_value
12+
, AVG(payment_value) AS avg_value
13+
FROM olist_order_payments_dataset
14+
WHERE payment_type = 'credit_card'
15+
GROUP BY payment_installments;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
-- @ss.idx: 1
2+
-- @ss.level: 3
3+
-- @ss.title: 복수 국적 메달 수상한 선수 찾기
4+
-- @ss.slug: multiple-medalist
5+
-- @ss.category: JOIN/UNION
6+
-- @ss.note:
7+
8+
SELECT a.name
9+
FROM athletes a
10+
JOIN records r ON r.athlete_id = a.id
11+
JOIN games g ON g.id = r.game_id
12+
WHERE r.medal != ""
13+
AND g.year >= 2000
14+
GROUP BY a.id
15+
HAVING COUNT(DISTINCT r.team_id) >= 2
16+
ORDER BY a.name;

0 commit comments

Comments
 (0)