viewbins

0

Please login or register to vote for this query.

(click on this box to dismiss)

Mathematica Meta

Q&A about the site for users of Wolfram Mathematica

WITH RankedQuestions AS (
  SELECT 
    Id,
    CAST(ViewCount AS BIGINT) AS ViewCount,
    ROW_NUMBER() OVER (ORDER BY ViewCount DESC) AS row_num,
    COUNT(*) OVER () AS total_questions
  FROM Posts
  WHERE PostTypeId = 1  -- 1 represents questions in the Posts table
),
Top10Percent AS (
  SELECT 
    SUM(CAST(ViewCount AS FLOAT)) AS top_10_views
  FROM RankedQuestions
  WHERE row_num <= CEILING(0.1 * total_questions)
),
TotalViews AS (
  SELECT SUM(CAST(ViewCount AS FLOAT)) AS total_views
  FROM Posts
  WHERE PostTypeId = 1  -- 1 represents questions in the Posts table
)
SELECT 
  (top_10_views * 100.0 / NULLIF(total_views, 0)) AS top_10_percent_view_ratio
FROM Top10Percent, TotalViews;

Enter Parameters

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