กิจกรรมแท็ก X ทุกโพสต์ ไม่จำเป็นต้องใช้ทุกตาราง
Activity for tag X, all posts.It is not neccessary to use all the tables.
 Votes:  Id [ number]  PostId [ number]  VoteTypeId [ number]  UserId [ number]  CreationDate [ time]  BountyAmount [ number] 
WITH userdata AS (SELECT Id, Reputation, age, CASE WHEN age >= 15 AND age <= 39 THEN 'younger' WHEN age > 39 AND age <= 70 THEN 'veteran' END AS age_cat, (SELECT CAST(SUM(all_answers.Score) AS FLOAT) / COUNT(DISTINCT all_answers.Id) AS avg_score FROM Posts AS all_answers WHERE all_answers.PostTypeId = 2 AND all_answers.OwnerUserId = answerer.Id) AS avg_score FROM Users AS answerer WHERE answerer.Reputation BETWEEN 2 AND 100000 AND answerer.age BETWEEN 15 AND 70) SELECT age, age_cat, Reputation, avg_score FROM userdata AS a WHERE a.Id = 196709