The goal of this query is to compare the trend of the number of Python 2 vs. Python 3 related questions. I started with 2012, because there were very few questions before that.
For more information on the purpose of the query, see https://www.webucator.com/blog/2016/03/still-using-python-2-it-is-time-to-upgrade/.
Q&A for professional and enthusiast programmers
-- Python 2.x vs. Python 3.x
SELECT left(t.TagName,8) AS Tag,
DATEPART(Q,p.CreationDate) AS q, YEAR(p.CreationDate) AS y,
COUNT(p.Id) AS NumPosts
FROM Tags t
JOIN PostTags pt ON pt.TagID = t.Id
JOIN Posts p ON p.Id = pt.PostId
WHERE (t.TagName LIKE 'python-2%' OR t.TagName LIKE 'python-3%')
AND YEAR(p.CreationDate) >= 2012
GROUP BY left(t.TagName,8), DATEPART(Q, p.CreationDate), YEAR(p.CreationDate)
ORDER BY y, q, Tag DESC