Q&A about the site for professional and independent game developers
WITH UnregisteredUsers AS ( SELECT Id, Reputation FROM Users WHERE DisplayName IS NULL ), AverageReputation AS ( SELECT AVG(CAST(Reputation AS Float)) AS AvgRep FROM UnregisteredUsers ), AverageScores AS ( SELECT SUM(CASE WHEN p.PostTypeId = 1 THEN 1 ELSE 0 END) / CAST(COUNT(DISTINCT u.Id) AS Float) AS AvgQuestionCount, AVG(CASE WHEN p.PostTypeId = 1 THEN CAST(p.Score AS float) ELSE 0 END) AS AvgQuestionScore, SUM(CASE WHEN p.PostTypeId = 2 THEN 1 ELSE 0 END) / CAST(COUNT(DISTINCT u.Id) AS Float) AS AvgAnswerCount, AVG(CASE WHEN p.PostTypeId = 2 THEN CAST(p.Score AS float) ELSE 0 END) AS AvgAnswerScore FROM UnregisteredUsers u INNER JOIN Posts p ON p.OwnerUserId = u.Id ) SELECT * FROM AverageReputation CROSS JOIN AverageScores