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 for designers and users of artificial or invented languages, consciously developed instead of having developed naturally
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 cast(Tags as varchar) as [Tags per question], cast(QuestionCount as varchar) as [Number of questions] from Counts union all select '', '' union all select 'Average', 'Total questions' union all select '----------------------------', '----------------------------' union all select cast((cast(sum(Tags * QuestionCount) as decimal) / sum(QuestionCount)) as varchar), convert(varchar, cast(sum(QuestionCount) as money), 1) from Counts