To demonstrate why not having class makes searching the data complex (and in case anyone out there is trying to figure out these queries). Keeping in mind that Data Explorer is significantly out of date.
(1) tag-related gold badges
Since we know that:
- tag-related badges are lower case
- a badge for a tag at a certain level only exists when it's been awarded once
- to have a gold tag-related badge you must have all three (bronze, silver, gold)
- a tag-related badge can only be awarded to each user once
;WITH x AS
(
SELECT Name, UserId, c = count(*)
FROM dbo.Badges
WHERE ASCII(LEFT(Name, 1)) BETWEEN 97 AND 122
GROUP BY Name, UserId
HAVING COUNT(*) = 3
-- for silver, >= 2
-- for bronze, >= 1
)
SELECT Name, [Count] = COUNT(*)
FROM x
GROUP BY Name
ORDER BY [Count] DESC;
(2) For non-tag-related gold badges, we currently need to know the names. This query shows the number of users who received each badge at least once, and also the total number of times the badge has been awarded.
SELECT
Name,
[User Count] = COUNT(DISTINCT UserId),
[Total] = COUNT(UserId)
FROM dbo.Badges
WHERE Name IN
(
N'Copy Editor',
N'Electorate',
N'Famous Question',
N'Fanatic',
N'Great Answer',
N'Great Question',
N'Legendary',
N'Marshal',
N'Populist',
N'Publicist',
N'Reversal',
N'Stellar Question',
N'Steward',
N'Unsung Hero'
)
GROUP BY Name
ORDER BY [User Count] DESC;
Feel free to fork these queries if you want to discover other information (like who all those people are).
https://data.stackexchange.com/stackoverflow/revision/80698/92524/gold-badge-counts