Q&A for active researchers, academics and students of physics
-- Minimum number of answers a user must have written to be included.
DECLARE @MinAnswers int = ##MinAnswers##
Users.Id AS [User Link],
SUM(Posts.Score) AS "Upvotes earned",
COUNT(*) AS "Answers written",
1.0 * SUM(Posts.Score) / COUNT(*) AS "Average answer score",
MAX(Posts.Score) AS "Highest answer score",
1.0 * MAX(Posts.Score) / COUNT(*) AS "Highest answer / number of answers"
FROM Posts LEFT JOIN Users
ON Posts.OwnerUserId = Users.Id
WHERE Posts.PostTypeId = 2
GROUP BY Users.Id
HAVING COUNT(*) >= @MinAnswers
ORDER BY "Average answer score" DESC