Returns average number of tags per question on a site.
Additionally it also returns tag count breakdown with question counts.
Best viewed as "Text-only results"
Q&A about the site for software engineers working on automated testing, continuous delivery, service integration and monitoring, and building SDLC infrastructure
with Counts as (
len(Tags) - len(replace(Tags, '<', '')) as Tags,
count(*) as QuestionCount
where PostTypeId = 1
group by len(Tags) - len(replace(Tags, '<', ''))
cast(Tags as varchar) as [Tags per question],
replace(convert(varchar, cast(QuestionCount as money), 1), '.00', '') as [Number of questions]
'Avg = ' + cast((cast(sum(Tags * QuestionCount) as decimal) / sum(QuestionCount)) as varchar),
'All = ' + replace(convert(varchar, cast(sum(QuestionCount) as money), 1), '.00', '')