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
BrandonXLF
.
Toggle Highlighting
SQL
# redirect SELECT DISTINCT COUNT(rd_from) FROM redirect # DIRECT WHERE START WHERE rd_title = 'Toronto' AND rd_namespace = 0 AND (rd_interwiki IS NULL OR rd_interwiki = ''); # DIRECT WHERE END # pagelinks, categorylinks SELECT COUNT(DISTINCT pl_from), SUM(indirect), SUM(NOT indirect) FROM ( # INDIRECT SELECT START SELECT DISTINCT pl_from, 1 AS indirect FROM redirect JOIN page AS target ON target.page_id = rd_from JOIN pagelinks ON pl_title = target.page_title AND pl_namespace = target.page_namespace WHERE rd_namespace = 0 AND rd_title = 'Toronto' AND (rd_interwiki IS NULL OR rd_interwiki = '') # INDIRECT SELECT END UNION ALL SELECT pl_from, 0 AS indirect FROM pagelinks # DIRECT WHERE START WHERE pl_title = 'Toronto' AND pl_namespace = 0 # DIRECT WHERE END ) AS temp; # templatelinks, imagelinks # SELECT COUNT(DISTINCT tl_from), COUNT(DISTINCT indirect_from), COUNT(DISTINCT tl_from) - COUNT(DISTINCT indirect_from) FROM templatelinks SELECT COUNT(tl_from), COUNT(indirect), COUNT(tl_from) - COUNT(indirect) FROM templatelinks LEFT JOIN ( # INDIRECT SELECT START SELECT DISTINCT tl_from AS indirect_from, 1 AS indirect FROM redirect JOIN page AS target ON target.page_id = rd_from JOIN templatelinks ON tl_title = target.page_title AND tl_namespace = target.page_namespace WHERE rd_title = 'BrandonXLF/J' AND rd_namespace = 2 AND (rd_interwiki IS NULL OR rd_interwiki = '') # INDIRECT SELECT END ) AS temp ON tl_from = indirect_from # DIRECT WHERE START WHERE tl_title = 'BrandonXLF/J' AND tl_namespace = 2; # DIRECT WHERE END /* SELECT COUNT(DISTINCT tl_from), SUM(indirect), SUM(NOT indirect) FROM ( # INDIRECT SELECT START SELECT DISTINCT tl_from, 1 AS indirect FROM redirect JOIN page AS target ON target.page_id = rd_from JOIN templatelinks ON tl_title = target.page_title AND tl_namespace = target.page_namespace WHERE rd_title = 'BrandonXLF/J' AND rd_namespace = 2 AND (rd_interwiki IS NULL OR rd_interwiki = '') # INDIRECT SELECT END UNION ALL SELECT tl_from, 0 AS indirect FROM pagelinks # DIRECT WHERE START WHERE tl_title = 'BrandonXLF/J' AND tl_namespace = 2; # DIRECT WHERE END ) AS temp; 8/
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...