Q&A for professional and enthusiast programmers
SELECT 1, avg(reputation) average, ((avg(reputation) - 1) / 1.0) * 100 percentage FROM users u1 WHERE u1.reputation >= 1 AND u1.reputation < 200 UNION SELECT 200, avg(u200.reputation) average, ((avg(u200.reputation) - 200) / 200.0) * 100 percentage FROM users u200 WHERE u200.reputation >= 200 AND u200.reputation < 500 UNION SELECT 500, avg(u500.reputation) average, ((avg(u500.reputation) - 500) / 500.0) * 100 percentage FROM users u500 WHERE u500.reputation >= 500 AND u500.reputation < 1000 UNION SELECT 1000, avg(u1000.reputation) average, ((avg(u1000.reputation) - 1000) / 1000.0) * 100 percentage FROM users u1000 WHERE u1000.reputation >= 1000 AND u1000.reputation < 2000 UNION SELECT 2000, avg(u2000.reputation) average, ((avg(u2000.reputation) - 2000) / 2000.0) * 100 percentage FROM users u2000 WHERE u2000.reputation >= 2000 AND u2000.reputation < 3000 UNION SELECT 3000, avg(u3000.reputation) average, ((avg(u3000.reputation) - 3000) / 3000.0) * 100 percentage FROM users u3000 WHERE u3000.reputation >= 3000 AND u3000.reputation < 5000 UNION SELECT 5000, avg(u5000.reputation) average, ((avg(u5000.reputation) - 5000) / 5000.0) * 100 percentage FROM users u5000 WHERE u5000.reputation >= 5000 AND u5000.reputation < 10000 UNION SELECT 10000, avg(u10000.reputation) average, ((avg(u10000.reputation) - 10000) / 10000.0) * 100 percentage FROM users u10000 WHERE u10000.reputation >= 10000 AND u10000.reputation < 25000 UNION SELECT 25000, avg(u25000.reputation) average, ((avg(u25000.reputation) - 25000) / 25000.0) * 100 percentage FROM users u25000 WHERE u25000.reputation >= 25000 AND u25000.reputation < 50000 UNION SELECT 50000, avg(u50000.reputation) average, ((avg(u50000.reputation) - 50000) / 50000.0) * 100 percentage FROM users u50000 WHERE u50000.reputation >= 50000 AND u50000.reputation < 100000 UNION SELECT 100000, avg(u100000.reputation) average, ((avg(u100000.reputation) - 100000) / 100000.0) * 100 percentage FROM users u100000 WHERE u100000.reputation >= 100000