SELECT concat( p.page_namespace, ":", p.page_title, " redirects to [[", r.rd_title, "]]" )
AS "Cross-namespace redirects to mainspace"
FROM redirect r
INNER JOIN page p ON p.page_id = r.rd_from
WHERE p.page_namespace != 0
AND p.page_namespace != 1
AND p.page_namespace != 2
AND p.page_namespace != 3
AND p.page_namespace != 4
AND p.page_namespace != 5
AND p.page_namespace != 6
AND p.page_namespace != 10
AND p.page_namespace != 12
AND p.page_namespace != 100
AND p.page_namespace != 118
AND p.page_namespace != 119
AND p.page_namespace != 126
AND r.rd_namespace = 0
#AND p.page_title NOT LIKE '%/%'
ORDER by page_title;
SELECT COUNT(*)
AS "Total redirects from Talk: to mainspace"
FROM redirect r
INNER JOIN page p ON p.page_id = r.rd_from
WHERE r.rd_namespace = 0
AND p.page_namespace = 1;
SELECT COUNT(*)
AS "Total redirects from User: to mainspace"
FROM redirect r
INNER JOIN page p ON p.page_id = r.rd_from
WHERE r.rd_namespace = 0
AND p.page_namespace = 2;
SELECT COUNT(*)
AS "Total redirects from User talk: to mainspace"
FROM redirect r
INNER JOIN page p ON p.page_id = r.rd_from
WHERE r.rd_namespace = 0
AND p.page_namespace = 3;
SELECT COUNT(*)
AS "Total redirects from Wikipedia: to mainspace"
FROM redirect r
INNER JOIN page p ON p.page_id = r.rd_from
WHERE r.rd_namespace = 0
AND p.page_namespace = 4;
SELECT COUNT(*)
AS "Total redirects from Wikipedia talk: to mainspace"
FROM redirect r
INNER JOIN page p ON p.page_id = r.rd_from
WHERE r.rd_namespace = 0
AND p.page_namespace = 5;
SELECT concat( "[https://en.wikipedia.org/w/index.php?title=File:{{urlencode:",
p.page_title, "}}&redirect=no File:", p.page_title, "] redirects to [[", r.rd_title, "]]" )
AS "Redirects from File: to mainspace"
FROM redirect r
INNER JOIN page p ON p.page_id = r.rd_from
WHERE p.page_namespace = 6
AND r.rd_namespace = 0
ORDER by page_title;
SELECT COUNT(*)
AS "Total redirects from Template: to mainspace"
FROM redirect r
INNER JOIN page p ON p.page_id = r.rd_from
WHERE r.rd_namespace = 0
AND p.page_namespace = 10;
SELECT concat( "[https://en.wikipedia.org/w/index.php?title=Help:{{urlencode:",
p.page_title, "}}&redirect=no Help:", p.page_title, "] redirects to [[", r.rd_title, "]]" )
AS "Redirects from help to mainspace"
FROM redirect r
INNER JOIN page p ON p.page_id = r.rd_from
WHERE p.page_namespace = 12
AND r.rd_namespace = 0
ORDER by page_title;
SELECT COUNT(*)
AS "Total redirects from Portal: to mainspace"
FROM redirect r
INNER JOIN page p ON p.page_id = r.rd_from
WHERE r.rd_namespace = 0
AND p.page_namespace = 100;
SELECT COUNT(*)
AS "Total redirects from Draft: to mainspace"
FROM redirect r
INNER JOIN page p ON p.page_id = r.rd_from
WHERE r.rd_namespace = 0
AND p.page_namespace = 118;
SELECT COUNT(*)
AS "Total redirects from Draft talk: to mainspace"
FROM redirect r
INNER JOIN page p ON p.page_id = r.rd_from
WHERE r.rd_namespace = 0
AND p.page_namespace = 119;
SELECT concat( "[https://en.wikipedia.org/w/index.php?title=MOS:{{urlencode:",
p.page_title, "}}&redirect=no MOS:", p.page_title, "] redirects to [[", r.rd_title, "]]" )
AS "Redirects from MOS: (namespace 126) to mainspace"
FROM redirect r
INNER JOIN page p ON p.page_id = r.rd_from
WHERE p.page_namespace = 126
AND r.rd_namespace = 0
ORDER by page_title;
SELECT COUNT(*)
AS "Total cross-namespace redirects to mainspace"
FROM redirect r
INNER JOIN page p ON p.page_id = r.rd_from
WHERE r.rd_namespace = 0
AND p.page_namespace != 0;