SQL
x
USE arwiki_p;
WITH daily_changes AS (
SELECT r.rev_page, p.page_title, r.rev_id, a.actor_name,
ABS(r.rev_len - IFNULL(pr.rev_len, 0)) AS size_change
FROM revision r
JOIN page p ON r.rev_page = p.page_id
LEFT JOIN revision pr ON r.rev_page = pr.rev_page AND r.rev_parent_id = pr.rev_id
JOIN actor a ON r.rev_actor = a.actor_id
WHERE r.rev_timestamp BETWEEN '20240713000000' AND '20240713235959'
AND p.page_namespace = 0
),
total_changes AS (
SELECT rev_page, SUM(size_change) AS total_change
FROM daily_changes
GROUP BY rev_page
)
SELECT dc.page_title, dc.actor_name, dc.size_change,
ROUND((dc.size_change / tc.total_change) * 100, 2) AS percent_change
FROM daily_changes dc
JOIN total_changes tc ON dc.rev_page = tc.rev_page
ORDER BY dc.size_change DESC
LIMIT 50;
By running queries you agree to the Cloud Services Terms of Use and you irrevocably agree to release your SQL under CC0 License.
All SQL code is licensed under CC0 License.