Aggregate registrations against the global user count
SELECT
contest_id,
ROUND(COUNT(user_id) * 100.0 / (SELECT COUNT(*) FROM users), 2) AS percentage
FROM register
GROUP BY contest_id
ORDER BY percentage DESC, contest_id ASCThis is the shortest correct solution. The subquery provides the total user population once, and each contest group divides its registration count by that same denominator.