Answer score quartiles as a function of length

0

Please login or register to vote for this query.

(click on this box to dismiss)

Plots quartiles of the answer score distribution as a function of answer length.

DevOps Meta

Q&A about the site for software engineers working on automated testing, continuous delivery, service integration and monitoring, and building SDLC infrastructure

WITH 
AllQuartiles(RoundedLength,PostScore,Quartile)
AS (
  SELECT TOP(1000000000) 
  ROUND(LEN(Body), -##exp?3##)+0.5E3 AS RoundedLength,
  Score AS PostScore,
  NTILE(4) OVER(PARTITION BY ROUND(LEN(Body), -3) ORDER BY Score) AS Quartile
  FROM Posts
  WHERE 
    PostTypeId = 2 AND
    LEN(Body) <= 12000
  ORDER BY
    ROUND(LEN(Body), -3),Score
)
SELECT 
  RoundedLength,MAX(PostScore)
FROM 
  AllQuartiles
WHERE
  Quartile!=4
GROUP BY
  Quartile,RoundedLength
ORDER BY
  RoundedLength,Quartile

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results