Count number of tags

1

Please login or register to vote for this query.

(click on this box to dismiss)

Counts all tags on a given StackExchange site and returns the sorted list.

Lifehacks

Q&A for people looking to bypass life's everyday problems with simple tricks

-- Returns sourted tag counts:
-- (Tag Name), (Cont: Tag1 and Tag2 are in the same post),
-- e.g.:
-- c#, 319081
-- java, 262885
-- ...

DECLARE @MinCounts int = ##MinCounts##
-- For StackOverflow 10000 is a typical value
-- For other StackExachange sites you can safely use 10

SELECT -- TOP 100
    T.TagName Tag,
    count(*) TagCount
FROM Posts P
    INNER JOIN PostTags PT ON PT.PostId = P.Id
    INNER JOIN Tags T ON T.Id = PT.TagId
WHERE
    P.PostTypeId = 1 -- only questions
GROUP BY
    T.TagName
HAVING
    count(*) >= @MinCounts
ORDER BY
    TagCount DESC

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results