Skip to content

1633. Percentage of Users Attended a Contest 👍

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
SELECT
  contest_id,
  ROUND(
    COUNT(user_id) * 100 / (
      SELECT COUNT(*)
      FROM Users
    ),
    2
  ) AS percentage
FROM Register
GROUP BY 1
ORDER BY percentage DESC, contest_id;