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
Matěj Suchánek
.
Toggle Highlighting
SQL
USE cswiki_p; SELECT disambig.page_title, sub.pl_title, IF(target.page_title IS NULL, 0, 1) AS page_exists, IF(target.page_is_redirect = 1, 1, 0) AS page_is_redirect FROM ( SELECT DISTINCT SUBSTRING_INDEX(pl_title, '_(', 1) AS title, pl_title, pl_namespace FROM pagelinks WHERE pl_title LIKE '%&_(%)' ESCAPE '&' AND pl_namespace = 0 AND pl_from_namespace = 0 ) AS sub JOIN page AS disambig ON disambig.page_title = sub.title AND disambig.page_namespace = sub.pl_namespace JOIN page_props ON pp_page = disambig.page_id LEFT JOIN page AS target ON target.page_title = sub.pl_title AND target.page_namespace = sub.pl_namespace LEFT JOIN pagelinks AS dlinks ON dlinks.pl_from = disambig.page_id AND dlinks.pl_namespace = sub.pl_namespace AND dlinks.pl_title = sub.pl_title WHERE pp_propname = 'disambiguation' AND dlinks.pl_from IS NULL /*AND NOT EXISTS ( SELECT 1 FROM pagelinks AS dlinks WHERE dlinks.pl_from = disambig.page_id AND dlinks.pl_title = sub.pl_title AND dlinks.pl_namespace = sub.pl_namespace )*/ ORDER BY disambig.page_namespace, disambig.page_title, sub.pl_namespace, sub.pl_title;
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...