Data behind Stack Overflow Trends

0

Please login or register to vote for this query.

(click on this box to dismiss)

Joomla

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

DECLARE @startDate DATE = '2008-08-01';
DECLARE @endDate DATE = '2018-10-01';

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

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

select [Year], [Month], Tags.TagName as Tag, Count(*) as Number
  into #MonthTagNumber
  from #PostSet
  join PostTags on #PostSet.PostId = PostTags.PostId
  join Tags on PostTags.TagId = Tags.Id
  /* where Tags.TagName in ('python', 'r', 'julia-lang') */
  /* If you want all tags above 2000: */
  where Tags.Count >= 10000
  group by [Year], [Month], Tags.TagName

select #MonthTagNumber.[Month] as [Month],
       #MonthTagNumber.[Year] as [Year],
       Tag, Number, Total
  from #MonthTagNumber
  join #MonthTotals on #MonthTagNumber.[Month] = #MonthTotals.[Month] and
                       #MonthTagNumber.[Year] = #MonthTotals.[Year]
  order by #MonthTagNumber.[Year], #MonthTagNumber.[Month], Tag

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results