Compare Size and Growth Trends for StackOverflow Tags

23

Please login or register to vote for this query.

(click on this box to dismiss)

Ukrainian Language Meta

Q&A about the site for linguists, teachers and students of the Ukrainian language

DECLARE @Tag1 nvarchar(max) = 'angularjs'
DECLARE @Tag2 nvarchar(max) = 'knockout.js'

DECLARE @1MonthsAgo datetime = DATEADD(month, -1, GETDATE())
DECLARE @2MonthsAgo datetime = DATEADD(month, -2, GETDATE())
DECLARE @3MonthsAgo datetime = DATEADD(month, -3, GETDATE())
DECLARE @4MonthsAgo datetime = DATEADD(month, -4, GETDATE())

DECLARE @Tag1Count1Months decimal (12,6), @g1 decimal (12,6)
DECLARE @Tag1Count2Months decimal (12,6)
DECLARE @Tag1Count3Months decimal (12,6)
DECLARE @Tag1Count4Months decimal (12,6)

DECLARE @Tag2Count1Months decimal (12,6)
DECLARE @Tag2Count2Months decimal (12,6)
DECLARE @Tag2Count3Months decimal (12,6)
DECLARE @Tag2Count4Months decimal (12,6)

-- Tag 1 Activity Last 3 months
SET @Tag1Count4Months = (SELECT COUNT(*) AS Posts FROM Tags
    INNER JOIN PostTags ON PostTags.TagId = Tags.id
    INNER JOIN Posts ON Posts.ParentId = PostTags.PostId
where tagname = @Tag1 AND
posts.creationdate > @1MonthsAgo
group by tagname);

SET @Tag1Count3Months = (SELECT COUNT(*) AS Posts FROM Tags
    INNER JOIN PostTags ON PostTags.TagId = Tags.id
    INNER JOIN Posts ON Posts.ParentId = PostTags.PostId
where tagname = @Tag1 AND
posts.creationdate > @2MonthsAgo and posts.creationdate < @1MonthsAgo
group by tagname);

SET @Tag1Count2Months = (SELECT COUNT(*) AS Posts FROM Tags
    INNER JOIN PostTags ON PostTags.TagId = Tags.id
    INNER JOIN Posts ON Posts.ParentId = PostTags.PostId
where tagname = @Tag1 AND
posts.creationdate > @3MonthsAgo and posts.creationdate < @2MonthsAgo
group by tagname);

SET @Tag1Count1Months = (SELECT COUNT(*) AS Posts FROM Tags
    INNER JOIN PostTags ON PostTags.TagId = Tags.id
    INNER JOIN Posts ON Posts.ParentId = PostTags.PostId
where tagname = @Tag1 AND
posts.creationdate > @4MonthsAgo and posts.creationdate < @3MonthsAgo
group by tagname);

select convert(varchar,convert(decimal(5,2),@Tag1Count4Months / @Tag1Count3Months* 100.0)) + '%'


-- Tag 2 Activity Last 3 months
SELECT TagName, COUNT(*) AS Posts FROM Tags
    INNER JOIN PostTags ON PostTags.TagId = Tags.id
    INNER JOIN Posts ON Posts.ParentId = PostTags.PostId
where tagname = @Tag2 AND
posts.creationdate > @1MonthsAgo
group by tagname

SELECT TagName, COUNT(*) AS Posts FROM Tags
    INNER JOIN PostTags ON PostTags.TagId = Tags.id
    INNER JOIN Posts ON Posts.ParentId = PostTags.PostId
where tagname = @Tag2 AND
posts.creationdate > @2MonthsAgo and posts.creationdate < @1MonthsAgo
group by tagname

SELECT TagName, COUNT(*) AS Posts FROM Tags
    INNER JOIN PostTags ON PostTags.TagId = Tags.id
    INNER JOIN Posts ON Posts.ParentId = PostTags.PostId
where tagname = @Tag2 AND
posts.creationdate > @3MonthsAgo and posts.creationdate < @2MonthsAgo
group by tagname

SELECT TagName, COUNT(*) AS Posts FROM Tags
    INNER JOIN PostTags ON PostTags.TagId = Tags.id
    INNER JOIN Posts ON Posts.ParentId = PostTags.PostId
where tagname = @Tag2 AND
posts.creationdate > @4MonthsAgo and posts.creationdate < @3MonthsAgo
group by tagname

Enter Parameters

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