Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
This query is marked as a draft
This query has been published
by
Andreyyshore
.
Testing a version that uses distinct column names, since the usual one suddenly started freaking out. Also, the results have been wrong since late February 2022 and I'm trying to investigate why.
Toggle Highlighting
SQL
USE rowiki_p; -- SELECT COUNT(1) AS pages_with_disambig_but_not_redir FROM page -- WHERE (page_namespace = 0 AND page_is_redirect = 0); SELECT user_id, CASE WHEN user_articles >= 10 THEN user_name ELSE CONCAT("<", COUNT(1), " other registered users>") END AS user_name, /*CASE WHEN user_articles >= 10 THEN user_articles ELSE*/ SUM(user_articles) /*END*/ AS user_articles, /*CASE WHEN user_articles >= 10 THEN user_latestcreation ELSE*/ MAX(user_latestcreation) /*END*/ AS user_latestcreation FROM ( SELECT CASE WHEN user_id IS NULL THEN 0 WHEN user_articles >= 10 THEN user_id ELSE -1 END AS user_id, user_name, user_articles, user_latestcreation FROM ( SELECT actor_user AS user_id, CASE WHEN actor_user IS NULL THEN CONCAT("<", COUNT(DISTINCT actor_id), " unregistered users>") ELSE actor_name END AS user_name, COUNT(1) AS user_articles, MAX(rev_timestamp) AS user_latestcreation FROM ( SELECT rev_actor, MIN(rev_timestamp) AS rev_timestamp FROM (SELECT * FROM revision LIMIT 10000) AS revision_ LEFT JOIN (SELECT * FROM page LIMIT 10000) AS page_ ON revision_.rev_page = page_.page_id WHERE (page_namespace = 0 AND page_is_redirect = 0) GROUP BY revision_.rev_page ) AS uti LEFT JOIN actor ON uti.rev_actor = actor.actor_id GROUP BY user_id ) AS uti_ ORDER BY user_id ) AS uti__ GROUP BY user_id ORDER BY user_articles DESC; /*SELECT user_id, CASE WHEN user_articles >= 10 THEN user_name ELSE CONCAT("<", COUNT(DISTINCT user_name), " other registered users>") END AS user_name, CASE WHEN user_articles >= 10 THEN user_articles ELSE SUM(user_articles) END AS articles, CASE WHEN user_articles >= 10 THEN user_latestcreation ELSE MAX(user_latestcreation) END AS user_latestcreation FROM (*/ SELECT CASE WHEN user_articles >= 10 THEN user_id ELSE -1 END AS user_id, user_name, user_articles, user_latestcreation FROM ( SELECT actor_user AS user_id, CASE WHEN actor_user IS NULL THEN CONCAT("<", COUNT(DISTINCT actor_id), " unregistered users>") ELSE actor_name END AS user_name, COUNT(1) AS user_articles, MAX(rev_timestamp) AS user_latestcreation FROM ( SELECT rev_actor, MIN(rev_timestamp) AS rev_timestamp FROM (SELECT * FROM revision LIMIT 10000) AS revision_ LEFT JOIN (SELECT * FROM page LIMIT 10000) AS page_ ON revision_.rev_page = page_.page_id WHERE (page_namespace = 0 AND page_is_redirect = 0) GROUP BY revision_.rev_page ) AS uti LEFT JOIN actor ON uti.rev_actor = actor.actor_id GROUP BY user_id ) AS uti_ /*) AS uti__ GROUP BY user_id */ ORDER BY user_articles DESC;
By running queries you agree to the
Cloud Services Terms of Use
and you irrevocably agree to release your SQL under
CC0 License
.
Submit Query
Stop Query
All SQL code is licensed under
CC0 License
.
Checking query status...