#92. [LeetCode / MySQL] 1633. Percentage of Users Attended a Contest

문제

 

입력 코드

SELECT 
    contest_id, 
    ROUND(COUNT(DISTINCT user_id)/(SELECT COUNT(user_id) FROM Users) * 100, 2) AS percentage
FROM Register 
GROUP BY contest_id
ORDER BY percentage DESC, contest_id ASC;

 

 

코드 설명

#SELECT #ROUND #COUNT #DISTINCT #GROUP BY #ORDER BY 

 

 

문제 출처

 

Percentage of Users Attended a Contest - LeetCode

Can you solve this real interview question? Percentage of Users Attended a Contest - Table: Users +-------------+---------+ | Column Name | Type | +-------------+---------+ | user_id | int | | user_name | varchar | +-------------+---------+ user_id is the

leetcode.com