SELECT TagName, ROUND( CAST(PostCount AS DECIMAL) / (SUM(...

0

Please login or register to vote for this query.

(click on this box to dismiss)

History of Science and Math

Q&A for people interested in the history and origins of science and mathematics

SELECT
  TagName,
  ROUND(
    CAST(PostCount AS DECIMAL) / (SUM(PostCount) OVER ()) * 100, 2
  ) AS MarketShare
FROM (
  SELECT
    COUNT(*)     PostCount,
    t.TagName AS TagName
  FROM Posts p
  JOIN PostTags pt ON p.Id = pt.PostId
  JOIN Tags t ON pt.TagId = t.Id AND
    t.TagName IN (
      'oracle', 'sql-server', 'postgresql', 'mysql',
      'db2', 'mongodb', 'redis', 'cassandra'
    )
  GROUP BY TagName
) db
ORDER BY MarketShare DESC

Enter Parameters

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