sql18(Leetcode1633各赛事的用户注册率)

代码:

# Write your MySQL query statement below

select r.contest_id,round(count(u.user_id)/(select count(user_id) from Users)*100,2) as percentage
from
    Register as r    
left join
    Users as u
on u.user_id=r.user_id
group by contest_id
order by percentage desc,contest_id

你可能感兴趣的:(leetcode)