Average answer length (and min and max)

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT
  u.Id AS [User Link],
  Count(*) AS [Answer count],
  Min(Len(p.Body)) AS [Min],
  Avg(Len(p.Body)) AS [Average],
  Max(Len(p.Body)) AS [Max],
  Var(Len(p.Body)) AS [Variance],
  Stdev(Len(p.Body)) AS [StDev]
FROM Users u, Posts p
WHERE p.OwnerUserId = u.Id
  AND p.PostTypeId = 2
  AND (SELECT Count(*)
       FROM Posts q
       WHERE q.OwnerUserId = u.Id AND p.PostTypeId = 2
       GROUP BY q.OwnerUserId) >= 10
GROUP BY u.Id
ORDER BY [Average]

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results