SQL
AخA
SELECT
p1.page_namespace,
CASE
WHEN p1.page_namespace = 6 THEN CONCAT('https://commons.wikimedia.org/wiki/File:', p1.page_title)
WHEN p1.page_namespace = 7 THEN CONCAT('https://commons.wikimedia.org/wiki/File_talk:', p1.page_title)
WHEN p1.page_namespace = 1 THEN CONCAT('https://commons.wikimedia.org/wiki/Talk:', p1.page_title)
WHEN p1.page_namespace = 2 THEN CONCAT('https://commons.wikimedia.org/wiki/User:', p1.page_title)
WHEN p1.page_namespace = 3 THEN CONCAT('https://commons.wikimedia.org/wiki/User_talk:', p1.page_title)
WHEN p1.page_namespace = 10 THEN CONCAT('https://commons.wikimedia.org/wiki/Template:', p1.page_title)
WHEN p1.page_namespace = 11 THEN CONCAT('https://commons.wikimedia.org/wiki/Template_talk:', p1.page_title)
WHEN p1.page_namespace = 102 THEN CONCAT('https://commons.wikimedia.org/wiki/TimedText:', p1.page_title)
WHEN p1.page_namespace = 103 THEN CONCAT('https://commons.wikimedia.org/wiki/TimedText_talk:', p1.page_title)
ELSE CONCAT('https://commons.wikimedia.org/wiki/', p1.page_title)
END AS page_title
FROM redirect AS rd
JOIN page p1
ON rd.rd_from = p1.page_id
LEFT JOIN page AS p2
ON rd.rd_namespace = p2.page_namespace
AND rd.rd_title = p2.page_title
WHERE rd.rd_namespace >= 6
AND p2.page_namespace IS NULL
ORDER BY p1.page_namespace ASC;
By running queries you agree to the Cloud Services Terms of Use and you irrevocably agree to release your SQL under CC0 License.
All SQL code is licensed under CC0 License.