question score as function of question length


Please login or register to vote for this query.

(click on this box to dismiss)


Q&A for people studying math at any level and professionals in related fields

DECLARE @IntervalLength INT; SET @IntervalLength = ##IntervalLength:int##;
DECLARE @MaximumLength INT; SET @MaximumLength = ##MaximumLength:int##;

SELECT (LEN(p.Body) / @IntervalLength) * @IntervalLength AS 'Answer length',
  CAST(SUM(p.Score) AS float) / SUM(1.0) AS 'Average score'
  FROM Posts AS p
  WHERE p.PostTypeId = 1 -- questions
    AND LEN(p.Body) < @MaximumLength
  GROUP BY (LEN(p.Body) / @IntervalLength) * @IntervalLength
  ORDER BY (LEN(p.Body) / @IntervalLength) * @IntervalLength

Enter Parameters

Switch to meta site
loading Hold tight while we fetch your results