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
EqJjgOa8rVvsRmZL
.
Toggle Highlighting
SQL
with recursive occur_index as ( select length(page_title) - length(replace(page_title, '/', '')) as occur, page_title, page_is_redirect from page where page_namespace = 4 ), parent_index (child, parent, occur) as ( select page_title, substring_index(page_title, '/', occur), occur from occur_index where occur != 0 union distinct select parent, substring_index(parent, '/', occur - 1), occur - 1 from parent_index where occur > 1 ), search (candidate, occur) as ( select distinct parent, 0 from parent_index where occur = 1 and parent not in (select page_title from occur_index where occur = 0) union distinct select child, search.occur + 1 from search join parent_index on candidate = parent and search.occur = parent_index.occur - 1 where candidate not in (select page_title from occur_index where occur = search.occur) ) select count(*) from occur_index join search on page_title = candidate where page_is_redirect = 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...