Average answer length of a user

3

Please login or register to vote for this query.

(click on this box to dismiss)

Queries for statistics related to the length of a given user's answers

Ask Ubuntu

Q&A for Ubuntu users and developers

DECLARE @UserId int = ##UserId##

SELECT
  u.Reputation, 
  Count(*) AS [Answer count],
  (SUM(p.Score) * 10 + COUNT(p.Id) * 15) / COUNT(p.Id) 
    AS 'AvgRepPerAnswer',
  Min(Len(p.Body)) AS [MinCharPerAns],
  Avg(Len(p.Body)) AS [AvgCharPerAns],
  Max(Len(p.Body)) AS [MaxCharPerAns]
   
FROM Users u LEFT JOIN Posts p ON (u.Id = P.OwnerUserId)
WHERE p.OwnerUserId = @UserId
  AND p.PostTypeId = 2
GROUP BY u.Reputation

Enter Parameters

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