2087. Confirmation Rate
My accepted SQL solution to LeetCode problem 2087, Confirmation Rate, running in 574ms.
- Difficulty: Medium
- SQL
- Runtime 574ms
- Memory 0.0B
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
SQL
Accepted on LeetCode — runtime 574ms, memory 0.0B, accepted 2025-12-29.
SELECT s.user_id,
ROUND(IFNULL(SUM(CASE WHEN c.action = 'confirmed' THEN 1 ELSE 0 END) / COUNT(c.action), 0), 2) AS confirmation_rate
FROM Signups s
LEFT JOIN Confirmations c ON s.user_id = c.user_id
GROUP BY s.user_id