Question stats by tag

4

Please login or register to vote for this query.

(click on this box to dismiss)

Audio-Video Production Meta

Q&A about the site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation

with median as (
  select TagName, ViewCount,
         -- http://stackoverflow.com/a/8846679/1438
         PERCENTILE_DISC(0.5) 
                  WITHIN GROUP (ORDER BY ViewCount)
                  OVER (PARTITION BY TagName)
               median_views,
               
         AnswerCount,
         PERCENTILE_DISC(0.5) 
                  WITHIN GROUP (ORDER BY AnswerCount)
                  OVER (PARTITION BY TagName)
               median_answers,
               
         Score,
         PERCENTILE_DISC(0.5) 
                  WITHIN GROUP (ORDER BY Score)
                  OVER (PARTITION BY TagName)
               median_score
  from Posts p
       join PostTags on p.Id = PostId
       join Tags t on t.Id = TagId
  where PostTypeId = 1
        and TagName in (##tag##)
)

select TagName, count(*) N, 
       avg(ViewCount) avg_views,         median_views,
       avg(1.0*AnswerCount) avg_answers, median_answers,
       avg(1.0*Score) avg_score,         median_score
from median
group by TagName, median_views, median_answers, median_score
order by count(*) desc

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results