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
MdsShakil
.
USE bnwiki_p;: Specifies the use of the bnwiki_p database for the query. SELECT CONCAT('# [[', page.page_title, ']]'): Selects pages where the main namespace redirects to the draft namespace, and it constructs a formatted output using the CONCAT function. It adds a prefix and suffix to the page_title to create a link to the draft namespace. FROM page: Specifies the main table to retrieve data from. JOIN redirect ON page.page_id = redirect.rd_from: Joins the page table with the redirect table based on the page ID. JOIN page AS target_page ON redirect.rd_namespace = target_page.page_namespace AND redirect.rd_title = target_page.page_title: Joins the redirect table with the page table (aliased as target_page) based on the namespace and title to identify the target page of the redirect. WHERE page.page_namespace = 0 AND target_page.page_namespace = 118;: Filters the results to include only those where the page is in the main namespace and the target page is in the draft namespace. The output of this query will provide a list of formatted links to pages in the main namespace that redirect to the draft namespace.
Toggle Highlighting
SQL
-- Specify the Wikimedia database USE bnwiki_p; -- Select pages where the main namespace redirects to the draft namespace SELECT CONCAT('# [[',page.page_title,']]') FROM page JOIN redirect ON page.page_id = redirect.rd_from JOIN page AS target_page ON redirect.rd_namespace = target_page.page_namespace AND redirect.rd_title = target_page.page_title WHERE page.page_namespace = 0 -- Main namespace AND target_page.page_namespace = 118; -- Draft namespace
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...