Fork of
Empty categories on Commons
by Achim55
This query is marked as a draft
This query has been published
by Achim55.
SQL
x
#USE stop;
USE commonswiki_p;
SELECT CONCAT ('[[Category:', REPLACE (page_title,'_',' '), ']]') AS touchlist
FROM page
INNER JOIN templatelinks ON tl_from = page_id AND tl_namespace = 10 AND tl_title = 'Category_redirect'
INNER JOIN pagelinks ON pl_from = page_id AND pl_from_namespace = 14 AND pl_namespace = 14
WHERE page_namespace = 14
AND (SELECT COUNT(*) FROM pagelinks pl2 WHERE pl2.pl_from = page_id AND pl2.pl_from_namespace = 14 AND pl2.pl_namespace = 14) = 1
AND NOT EXISTS (SELECT 1 FROM page p2 WHERE p2.page_namespace = 14 AND p2.page_title = pl_title)
LIMIT 250;
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.