Q&A for linguists, teachers and students of the Korean language
-- Relación entre reputación del usuario y la calidad de sus respuestas DECLARE @TagName NVARCHAR(100) = 'java' SELECT u.Reputation AS ReputacionUsuario, COUNT(a.Id) AS TotalRespuestas, COUNT(CASE WHEN a.Score >= 5 THEN 1 END) AS RespuestasConAltosVotos, COUNT(CASE WHEN p.AcceptedAnswerId = a.Id THEN 1 END) AS RespuestasAceptadas, ROUND((COUNT(CASE WHEN a.Score >= 5 THEN 1 END) * 100.0) / COUNT(a.Id), 2) AS PorcentajeAltosVotos, ROUND((COUNT(CASE WHEN p.AcceptedAnswerId = a.Id THEN 1 END) * 100.0) / COUNT(a.Id), 2) AS PorcentajeRespuestasAceptadas FROM Posts p JOIN PostTags pt ON p.Id = pt.PostId JOIN Tags t ON t.Id = pt.TagId JOIN Posts a ON a.ParentId = p.Id AND a.PostTypeId = 2 -- Respuestas JOIN Users u ON a.OwnerUserId = u.Id WHERE t.TagName = @TagName AND p.PostTypeId = 1 -- Preguntas GROUP BY u.Reputation ORDER BY u.Reputation DESC