본문 바로가기
SQL

leetcode 1934. Confirmation Rate

by 무적김두칠 2023. 4. 21.

https://leetcode.com/problems/confirmation-rate/description/

 

Confirmation Rate - LeetCode

Can you solve this real interview question? Confirmation Rate - Table: Signups +----------------+----------+ | Column Name | Type | +----------------+----------+ | user_id | int | | time_stamp | datetime | +----------------+----------+ user_id is the prima

leetcode.com

 

1
2
3
4
5
6
# Write your MySQL query statement below
select s.user_id, round(sum(case when c.action='confirmed' then 1 else 0 end)/count(s.user_id) , 2) confirmation_rate
from Confirmations c
right join Signups s
on c.user_id = s.user_id
group by s.user_id
cs
반응형

댓글