[문제]
[MySQL]
WITH Action_cnt AS (
SELECT s.user_id
, c.action
, CASE WHEN c.action = 'confirmed' THEN 1
ELSE 0
END AS action_cnt
FROM Signups AS s
LEFT JOIN Confirmations AS c ON s.user_id = c.user_id
)
SELECT user_id
, ROUND(SUM(action_cnt) / COUNT(*), 2) AS confirmation_rate
FROM Action_cnt
GROUP BY user_id
'SQL > LeetCode' 카테고리의 다른 글
| [LeetCode] 1978. Employees Whose Manager Left the Company (0) | 2025.02.21 |
|---|---|
| [LeetCode] 1965. Employees With Missing Information (0) | 2025.02.21 |
| [LeetCode] 1907. Count Salary Categories (0) | 2025.02.21 |
| [LeetCode] 1890. The Latest Login in 2020 (0) | 2025.02.21 |
| [LeetCode] 1873. Calculate Special Bonus (0) | 2025.02.21 |
