This query is marked as a draft This query has been published by Peter Bowman.

SQL

x
 
use plwiki_p;
set @max_links = 5;
select page_title, count(distinct pl_title) as n_links
from page inner join pagelinks on pl_from = page_id and pl_from_namespace = 0 and pl_namespace = 0 and page_is_redirect = 0
group by page_id
having n_links <= @max_links and page_id not in (
        select page_id
        from page inner join page_props on pp_page = page_id
        where pp_propname = "disambiguation"
    )
order by page_title;
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.

Checking query status...