Stack Overflow tags per year


Please login or register to vote for this query.

(click on this box to dismiss)

Amateur Radio

Q&A for amateur radio enthusiasts

DECLARE @startDate DATE = '2017-01-01';
DECLARE @endDate DATE = '2018-01-01';

select Id as PostId,
  YEAR(Posts.CreationDate) as [Year]
    into #PostSet
    from Posts
    where PostTypeId = 1 and
    DeletionDate is null and
    CreationDate >= @startDate

select [Year], Count(*) as Total
  into #YearTotals
  from #PostSet
  group by [Year]

select [Year], Tags.TagName as Tag, Count(*) as Number
  into #YearTagNumber
  from #PostSet
  join PostTags on #PostSet.PostId = PostTags.PostId
  join Tags on PostTags.TagId = Tags.Id
  where Tags.TagName in ('tidyr', 'purrr', 'tibble', 'ggplot2', 'dplyr')
  /* If you want all tags above 2000: 
  where Tags.Count >= 2000 */
  group by [Year], Tags.TagName

select #YearTagNumber.[Year] as [Year],
       Tag, Number, Total
  from #YearTagNumber
  join #YearTotals on #YearTagNumber.[Year] = #YearTotals.[Year]
  order by #YearTagNumber.[Year], Tag

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results