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
Certes
.
Toggle Highlighting
SQL
SET STATEMENT max_statement_time=600 FOR SELECT Ps.page_title AS islands, Pp.page_title AS archipelago, (SELECT COUNT(*) FROM pagelinks WHERE pl_namespace = 0 AND pl_title = Ps.page_title AND pl_from_namespace = 0) AS slinks, (SELECT COUNT(*) FROM pagelinks WHERE pl_namespace = 0 AND pl_title = Pp.page_title AND pl_from_namespace = 0) AS plinks FROM page Ps JOIN page Pp ON Pp.page_title = REGEXP_REPLACE(Ps.page_title, "Islands", "Archipelago") AND Pp.page_namespace = 0 WHERE Ps.page_namespace = 0 AND Ps.page_title LIKE "%_Islands" AND Ps.page_is_redirect = 0 /* Not sure about this restriction */ /* AND NOT EXISTS (SELECT 1 FROM redirect WHERE rd_from = Ps.page_id AND rd_namespace = 0 AND rd_title = Pp.page_title) /* Foo redirects to Foos */ AND NOT EXISTS (SELECT 1 FROM redirect WHERE rd_from = Pp.page_id AND rd_namespace = 0 AND rd_title = Ps.page_title) /* Foos redirects to Foo */ /* Needed only if islands can be a redirect: AND NOT EXISTS (SELECT 1 FROM redirect Rs JOIN redirect Rp ON Rp.rd_from = Pp.page_id AND Rp.rd_namespace = 0 AND Rp.rd_title = Rs.rd_title WHERE Rs.rd_from = Ps.page_id AND Rs.rd_namespace = 0) /* Foo and Foos redirect to same target */ AND NOT EXISTS (SELECT 1 FROM categorylinks WHERE cl_from = Ps.page_id AND cl_to = "All_disambiguation_pages") AND NOT EXISTS (SELECT 1 FROM categorylinks WHERE cl_from = Pp.page_id AND cl_to = "All_disambiguation_pages") /* Needed only if islands can be a redirect: AND NOT EXISTS (SELECT 1 FROM redirect JOIN page Pr ON Pr.page_title = rd_title AND Pr.page_namespace = 0 JOIN categorylinks ON cl_from = Pr.page_id AND cl_to = "All_disambiguation_pages" WHERE rd_from = Ps.page_id AND rd_namespace = 0) /* Foo redirects to a dab */ AND NOT EXISTS (SELECT 1 FROM redirect JOIN page Pr ON Pr.page_title = rd_title AND Pr.page_namespace = 0 JOIN categorylinks ON cl_from = Pr.page_id AND cl_to = "All_disambiguation_pages" WHERE rd_from = Pp.page_id AND rd_namespace = 0) /* Archipelago redirects to a dab */ ORDER BY islands LIMIT 1000;
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...