Stack Overflow tags per year


Please login or register to vote for this query.

(click on this box to dismiss)

Joomla Meta

Q&A about the site for Joomla! administrators, users, developers and designers

/* DECLARE @startDate DATE = '2008-08-01'; */ 
DECLARE @startDate DATE = '2017-01-01';
DECLARE @endDate DATE = '2017-12-31';

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 ('ggplot2', 'tidyr', 'dplyr', 'tibble')
  /* 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