SQL
AخA
WITH results AS
(SELECT COUNT(rev_page) AS pages, actor_name AS creator
FROM actor_revision
JOIN revision ON rev_actor = actor_id
WHERE rev_id IN
(SELECT MIN(rev_id)
FROM revision
WHERE rev_page IN
(SELECT DISTINCT birth.cl_from
FROM categorylinks AS birth
JOIN categorylinks AS stub ON stub.cl_from = birth.cl_from
JOIN categorylinks AS olym ON olym.cl_from = birth.cl_from
LEFT JOIN categorylinks AS medal ON medal.cl_from = birth.cl_from
AND (medal.cl_to LIKE '%Olympi%edalist%'
OR medal.cl_to LIKE '%edalist%Olympi%')
WHERE birth.cl_to IN ('1898_births', '1899_births', '1900_births', '1901_births', '1902_births',
'1903_births', '1904_births', '1905_births', '1906_births', '1907_births',
'1908_births', '1909_births', '1910_births', '1911_births', '1912_births',
'1913_births', '1914_births')
AND stub.cl_to = 'All_stub_articles'
AND olym.cl_to LIKE '%Olympi%'
AND medal.cl_to IS NULL)
GROUP BY rev_page)
GROUP BY actor_name)
SELECT SUM(pages) AS pages, 'TOTAL' AS creator FROM results
UNION
SELECT * FROM results ORDER BY pages DESC, creator ASC;
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.