Q&A for professional and enthusiast programmers
SELECT RANK() OVER (ORDER BY COUNT(*) DESC) rank, u.DisplayName, b.Name, COUNT(*) FROM Badges b JOIN Users u ON b.UserId = u.Id GROUP BY u.Id, u.DisplayName, b.Name ORDER BY COUNT(*) DESC