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 "Total upvotes",
COUNT(*) AS "Total answers",
1.0 * SUM(Posts.Score) / COUNT(*) AS "Ave. score",
1.0 * MAX(Posts.Score) / COUNT(*) AS "Highest score / # answers",
MAX(Posts.Score) AS "Highest score"
FROM Posts LEFT JOIN Users
ON Posts.OwnerUserId = Users.Id
WHERE Posts.PostTypeId = 2
GROUP BY Users.Id
HAVING COUNT(*) >= @MinAnswers
ORDER BY "Ave. score" DESC