LeetCode solutions

2087. Confirmation Rate

My accepted SQL solution to LeetCode problem 2087, Confirmation Rate, running in 574ms.

  • Difficulty: Medium
  • SQL
  • Runtime 574ms
  • Memory 0.0B

Read the problem on LeetCode View on GitHub

SQL

Accepted on LeetCode — runtime 574ms, memory 0.0B, accepted 2025-12-29.

sql
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

Source