Proportion of question upvotes to answer upvotes


Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

Supporting data for hypothesis at

with q_a_rep as
    , count(*) as row_cnt
    , max(q.score) as q_rep -- Question score
    , sum(coalesce(a.score, 0)) as a_rep -- Answer score
    , sum(case when q.score > a.score then 1 else 0 end) as q_gt_a
    id, title, viewcount, favoritecount, score, acceptedanswerid
    from posts 
    where score > 1
    and parentid is null -- is not an answer
    ) as q
  left join 
    id, parentid, body, viewcount, favoritecount, score
    from posts 
    ) as a
  -- on = a.parentid -- Use this to get all answers rep
  on q.acceptedanswerid = -- Use this for accepted answers
  group by
  -- having max(q.score) > sum(a.score)

-- For high question scores, find how many questions scored better than answers
, sum(row_cnt)                     as cnt_a
, sum(q_gt_a)                      as cnt_q_gt_a
, 1.0 * sum(q_gt_a) / sum(row_cnt) as ratio_q_a
, avg(a_rep)                       as avg_a_rep
, min(a_rep)                       as min_a_rep
, max(a_rep)                       as max_a_rep
from q_a_rep
group by q_rep
order by q_rep desc

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results