instruction: Distribution of the owners of the Epic badge by their estimated rep at the time of getting the badge.
response: WITH Raw AS (SELECT Posts.OwnerUserId AS "user_link", SUM(CASE WHEN Votes.VoteTypeId = 1 THEN 15 WHEN Votes.VoteTypeId = 2 THEN 10 ELSE -2 END) AS EstRep FROM Posts, Votes, Users, Badges WHERE Badges.Name = 'Epic' AND Badges.TagBased = 0 AND Badges.UserId = Users.Id AND Posts.OwnerUserId = Users.Id AND Posts.PostTypeId BETWEEN 1 AND 2 AND Posts.CommunityOwnedDate IS NULL AND Posts.Id = Votes.PostId AND Votes.VoteTypeId BETWEEN 1 AND 3 AND Votes.CreationDate < Badges.Date GROUP BY Posts.OwnerUserId) SELECT 1000 * FLOOR(0.001 * EstRep) AS EstRepK, COUNT(*) AS Count FROM Raw GROUP BY 1000 * FLOOR(0.001 * EstRep) ORDER BY EstRepK