SQL
x
SELECT p1.page_title, pl_title, COUNT(pl_title) as links
FROM page p1 LEFT JOIN pagelinks ON pl_from = p1.page_id AND pl_namespace = 0
AND pl_title IN (select p2.page_title from page p2 where p2.page_namespace = 0)
-- LEFT JOIN page p2 ON p2.page_title = pl_title AND p2.page_namespace = 0
WHERE p1.page_id IN (
select cl_from from category
join categorylinks on cl_to = cat_title and cl_type = 'page'
where cat_title in ("All_disambiguation_pages", "All_set_index_articles")
-- where cat_title rlike '^list|[^a-z]list' collate utf8_general_ci
-- or cat_title in ("All_disambiguation_pages", "All_set_index_articles")
)
AND p1.page_namespace = 0 AND p1.page_is_redirect = 0
GROUP BY p1.page_title
HAVING p1.page_title LIKE '%\_(disambiguation)' AND links < 2 OR links < 1
ORDER BY links
/*
SELECT p1.page_title, pl_title, COUNT(pl_title) as links
FROM page p1 join categorylinks on cl_from = p1.page_id and cl_type = 'page'
join category on cl_to = cat_title
and (cat_title in ("All_disambiguation_pages", "All_set_index_articles")
or cat_title rlike '^list|[^a-z]list' collate utf8_general_ci)
LEFT JOIN pagelinks ON pl_from = p1.page_id AND pl_namespace = 0
AND pl_title IN (select p2.page_title from page p2 where p2.page_namespace = 0)
-- LEFT JOIN page p2 ON p2.page_title = pl_title AND p2.page_namespace = 0
WHERE p1.page_namespace = 0 AND p1.page_is_redirect = 0
GROUP BY p1.page_title
HAVING p1.page_title LIKE '%\_(disambiguation)' AND links < 2 OR links < 1
ORDER BY links
*/
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.