Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
Fork of
Candidates to be linked from disambiguations on cswiki (redlinks)
by
Matěj Suchánek
This query is marked as a draft
This query has been published
by
Matěj Suchánek
.
Toggle Highlighting
SQL
USE cswiki_p; SELECT disambigs.page_title AS d, allpages.page_title AS t FROM page_props JOIN page AS disambigs ON disambigs.page_id = pp_page JOIN page AS allpages WHERE pp_propname = 'disambiguation' AND allpages.page_namespace = 0 AND allpages.page_title LIKE CONCAT(REPLACE(SUBSTRING_INDEX(disambigs.page_title, '_(', 1), '_', '&_'), '&_(%') ESCAPE '&' AND allpages.page_is_redirect = 0 AND allpages.page_title <> disambigs.page_title AND allpages.page_title NOT IN (SELECT pl_title FROM pagelinks WHERE pl_from = pp_page AND pl_namespace = 0) AND allpages.page_title NOT IN ( SELECT rd_title FROM pagelinks JOIN page AS outlinks ON outlinks.page_title = pl_title AND outlinks.page_namespace = pl_namespace JOIN redirect ON rd_from = outlinks.page_id WHERE pl_from = pp_page AND pl_namespace = 0 AND rd_namespace = 0 ) #AND allpages.page_title NOT IN (SELECT pl_title FROM pagelinks WHERE pl_from = pp_page AND pl_namespace = 0) LIMIT 10; /* SELECT possible.* FROM ( SELECT disambigs.page_title AS d, allpages.page_title AS t FROM page_props JOIN page AS disambigs ON disambigs.page_id = pp_page JOIN page AS allpages WHERE pp_propname = 'disambiguation' AND allpages.page_namespace = 0 AND allpages.page_title LIKE CONCAT(REPLACE(SUBSTRING_INDEX(disambigs.page_title, '_(', 1), '_', '&_'), '&_(%') ESCAPE '&' AND allpages.page_is_redirect = 0 AND allpages.page_title <> disambigs.page_title AND allpages.page_title NOT IN (SELECT pl_title FROM pagelinks WHERE pl_from = pp_page AND pl_namespace = 0) ) AS possible LEFT JOIN ( SELECT disambigs.page_title AS d, pl_title AS t FROM page_props JOIN page AS disambigs ON disambigs.page_id = pp_page JOIN pagelinks ON pl_from = disambigs.page_id WHERE pp_propname = 'disambiguation' AND pl_namespace = 0 ) AS present ON possible.d = present.d AND possible.t = possible.t WHERE present.d IS NULL /* UNION SELECT disambigs.page_title AS d, alllinks.pl_title AS t FROM page_props JOIN page AS disambigs ON disambigs.page_id = pp_page JOIN pagelinks AS alllinks WHERE pp_propname = 'disambiguation' AND alllinks.pl_namespace = 0 AND alllinks.pl_title LIKE CONCAT(REPLACE(SUBSTRING_INDEX(disambigs.page_title, '_(', 1), '_', '&_'), '&_(%') ESCAPE '&' AND alllinks.pl_title <> disambigs.page_title AND NOT EXISTS ( SELECT 1 FROM pagelinks AS outlinks WHERE outlinks.pl_from = pp_page AND outlinks.pl_namespace = 0 AND ( outlinks.pl_title = alllinks.pl_title OR outlinks.pl_title IN ( SELECT redirects.page_title FROM redirect JOIN page AS redirects ON page_id = rd_from WHERE rd_title = alllinks.pl_title AND rd_namespace = 0 ) ) )*/
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...