Database community size

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

WITH TagQACounts AS (
  SELECT 
    T.TagName, 
    COUNT(P.Id) AS QuestionCount,
    SUM(CASE WHEN AnswerCount > 0 THEN 1 ELSE 0 END) AS WithAnyAnswer,
    SUM(CASE WHEN AcceptedAnswerId IS NULL THEN 0 ELSE 1 END) AS WithAcceptedAnswer,
    AVG(CAST(P.AnswerCount as decimal(10,2))) AS AvgAnsCount
  FROM Posts P
    INNER JOIN PostTags PT ON PT.PostId = P.Id
    INNER JOIN Tags T ON T.Id = PT.TagId
  GROUP BY T.TagName
)

SELECT TagName, QuestionCount, WithAnyAnswer, WithAcceptedAnswer, AvgAnsCount,
  (WithAnyAnswer * 100.00)/QuestionCount AS PercentAnswered,
  (WithAcceptedAnswer * 100.00)/QuestionCount AS PercentAccepted
FROM TagQACounts
WHERE TagName IN ('mongodb','cassandra','dynamodb','postgres')

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results