Q&A for people who build and repair bicycles, people who train cycling, or commute on bicycles
-- Tasa de respuestas efectivas (altos votos o aceptadas) DECLARE @TagName NVARCHAR(100) = 'python' DECLARE @MinVotos INT = 5 -- Define el umbral de "altos votos" SELECT COUNT(DISTINCT a.Id) AS RespuestasTotales, COUNT(CASE WHEN a.Score >= @MinVotos THEN 1 END) AS RespuestasConAltosVotos, COUNT(CASE WHEN p.AcceptedAnswerId = a.Id THEN 1 END) AS RespuestasAceptadas, ROUND((COUNT(CASE WHEN a.Score >= @MinVotos 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 WHERE t.TagName = @TagName AND p.PostTypeId = 1 -- Preguntas