Questions asked per user, grouped by 1000s of rep

0

Please login or register to vote for this query.

(click on this box to dismiss)

Game Development

Q&A for professional and independent game developers

WITH PostsByUsersByKRep AS (
    SELECT FLOOR(u.Reputation/1000.0)  AS KRep,
    COUNT (p.Id) AS NumQuestions,
    COUNT (u.Id) AS UserCount

    FROM Posts p
    JOIN Users u ON u.Id=p.OwnerUserId
    WHERE p.PostTypeId = 1 AND ClosedDate IS NULL

    GROUP BY FLOOR(u.Reputation/1000.0)
), 
UsersByKRep AS (
    SELECT FLOOR(u.Reputation/1000.0) AS KRep,
    COUNT (u.Id) AS UserCount
    
    FROM Users u
    GROUP BY FLOOR(u.Reputation/1000.0)
)

SELECT ubk.KRep * 1000 'rep', 
CAST(pbubk.NumQuestions AS FLOAT) / CAST(ubk.UserCount AS FLOAT) 'Questions per user' 
FROM PostsByUsersByKRep pbubk
JOIN UsersByKRep ubk ON ubk.KRep = pbubk.KRep
ORDER BY ubk.KRep

Enter Parameters

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