Tag count per question stats

0

Please login or register to vote for this query.

(click on this box to dismiss)

Returns average number of tags per question on a site. Additionally it also returns tag count breakdown with question counts and percentages of all questions.

Ask Ubuntu

Q&A for Ubuntu users and developers

with Counts as (
  select
    len(Tags) - len(replace(Tags, '<', '')) as Tags,
    count(*) as QuestionCount
  from Posts
  where PostTypeId = 1
  group by len(Tags) - len(replace(Tags, '<', ''))
  )
select
  Tags as [Number of tags on question],
  cast(QuestionCount as varchar) as [Number of questions]
from Counts
union all
select
  cast(sum(Tags * QuestionCount) as decimal) / sum(QuestionCount),
  sum(QuestionCount)
from Counts

Enter Parameters

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