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.

Stack Overflow

Q&A for professional and enthusiast programmers

-- 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 sites:
loading Hold tight while we fetch your results