Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
Fork of
Bad links from dewiki to other wikis: redirects
by
Achim55
This query is marked as a draft
This query has been published
by
Achim55
.
Toggle Highlighting
SQL
USE dewiki_p; #USE dewikibooks_p; #USE dewikinews_p; #USE dewikiquote_p; #USE dewikisource_p; #USE dewikiversity_p; #USE dewikivoyage_p; #USE dewiktionary_p; #SET @w = LEFT (DATABASE(), LENGTH(DATABASE()) - 2); SET @l = (SELECT lang FROM meta_p.wiki WHERE dbname = @w); SET @l = 'de'; SET @lenen = LENGTH('https://en.wikipedia.org/wiki/'); SET @lenes = LENGTH('https://es.wikipedia.org/wiki/'); SET @lenfr = LENGTH('https://fr.wikipedia.org/wiki/'); SET @lenit = LENGTH('https://it.wikipedia.org/wiki/'); SET @lennl = LENGTH('https://nl.wiktpedia.org/wiki/'); SET @lenru = LENGTH('https://ru.wikipedia.org/wiki/'); SET @lensv = LENGTH('https://sv.wikipedia.org/wiki/'); SELECT now() AS timestamp; # enwiki #interwiki links to article redirects (SELECT CONCAT('# [[', IF (wp.page_namespace = 14, ':Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), ']] ', '• [{{fullurl:', IF (wp.page_namespace = 14, 'Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), '|action=edit}} edit] ', '→ [[:en:', REPLACE (iwl_title, '_', ' '), ']]') AS wikipage FROM iwlinks INNER JOIN page wp ON wp.page_id = iwl_from AND wp.page_namespace IN (0, 14) INNER JOIN enwiki_p.page cp ON cp.page_title = iwl_title AND cp.page_namespace = 0 AND cp.page_is_redirect = 1 WHERE iwl_prefix IN ('en') AND iwl_title LIKE 'Category:%' ) UNION #external links to article redirects (SELECT CONCAT('# [[', IF (wp.page_namespace = 14, ':Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), ']] ', '• [{{fullurl:', IF (wp.page_namespace = 14, 'Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), '|action=edit}} edit] ', '→ [[:en:', REPLACE (cp.page_title, '_', ' '), ']]') AS wikipage FROM externallinks INNER JOIN page wp ON wp.page_id = el_from AND wp.page_namespace IN (0, 14) INNER JOIN enwiki_p.page cp ON cp.page_title = SUBSTRING(REPLACE (el_to, CONCAT('?uselang=', @l), ''), IF ((LEFT (el_to, 5) = 'https'), @lenen + 1, @lenen)) AND cp.page_namespace = 0 AND cp.page_is_redirect = 1 WHERE ((el_to LIKE 'https://en.wikipedia.org/wiki/%') OR (el_to LIKE 'http://en.wikipedia.org/wiki/%')) AND el_to LIKE '%//en.wikipedia.org/wiki/Category:%' AND el_to NOT LIKE '%\%%' #temp ) UNION # eswiki #interwiki links to article redirects (SELECT CONCAT('# [[', IF (wp.page_namespace = 14, ':Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), ']] ', '• [{{fullurl:', IF (wp.page_namespace = 14, 'Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), '|action=edit}} edit] ', '→ [[:es:', REPLACE (iwl_title, '_', ' '), ']]') AS wikipage FROM iwlinks INNER JOIN page wp ON wp.page_id = iwl_from AND wp.page_namespace IN (0, 14) INNER JOIN eswiki_p.page cp ON cp.page_title = iwl_title AND cp.page_namespace = 0 AND cp.page_is_redirect = 1 WHERE iwl_prefix IN ('es') AND iwl_title LIKE 'Categoría:%' ) UNION #external links to article redirects (SELECT CONCAT('# [[', IF (wp.page_namespace = 14, ':Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), ']] ', '• [{{fullurl:', IF (wp.page_namespace = 14, 'Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), '|action=edit}} edit] ', '→ [[:es:', REPLACE (cp.page_title, '_', ' '), ']]') AS wikipage FROM externallinks INNER JOIN page wp ON wp.page_id = el_from AND wp.page_namespace IN (0, 14) INNER JOIN eswiki_p.page cp ON cp.page_title = SUBSTRING(REPLACE (el_to, CONCAT('?uselang=', @l), ''), IF ((LEFT (el_to, 5) = 'https'), @lenes + 1, @lenes)) AND cp.page_namespace = 0 AND cp.page_is_redirect = 1 WHERE ((el_to LIKE 'https://es.wikipedia.org/wiki/%') OR (el_to LIKE 'http://es.wikipedia.org/wiki/%')) AND el_to LIKE '%//es.wikipedia.org/wiki/Categoría:%' AND el_to NOT LIKE '%\%%' #temp ) UNION # frwiki #interwiki links to article redirects (SELECT CONCAT('# [[', IF (wp.page_namespace = 14, ':Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), ']] ', '• [{{fullurl:', IF (wp.page_namespace = 14, 'Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), '|action=edit}} edit] ', '→ [[:fr:', REPLACE (iwl_title, '_', ' '), ']]') AS wikipage FROM iwlinks INNER JOIN page wp ON wp.page_id = iwl_from AND wp.page_namespace IN (0, 14) INNER JOIN frwiki_p.page cp ON cp.page_title = iwl_title AND cp.page_namespace = 0 AND cp.page_is_redirect = 1 WHERE iwl_prefix IN ('fr') AND iwl_title LIKE 'Catégorie:%' ) UNION #external links to article redirects (SELECT CONCAT('# [[', IF (wp.page_namespace = 14, ':Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), ']] ', '• [{{fullurl:', IF (wp.page_namespace = 14, 'Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), '|action=edit}} edit] ', '→ [[:fr:', REPLACE (cp.page_title, '_', ' '), ']]') AS wikipage FROM externallinks INNER JOIN page wp ON wp.page_id = el_from AND wp.page_namespace IN (0, 14) INNER JOIN frwiki_p.page cp ON cp.page_title = SUBSTRING(REPLACE (el_to, CONCAT('?uselang=', @l), ''), IF ((LEFT (el_to, 5) = 'https'), @lenfr + 1, @lenfr)) AND cp.page_namespace = 0 AND cp.page_is_redirect = 1 WHERE ((el_to LIKE 'https://fr.wikipedia.org/wiki/%') OR (el_to LIKE 'http://fr.wikipedia.org/wiki/%')) AND el_to LIKE '%//fr.wikipedia.org/wiki/Catégorie:%' AND el_to NOT LIKE '%\%%' #temp ) UNION # itwiki #interwiki links to article redirects (SELECT CONCAT('# [[', IF (wp.page_namespace = 14, ':Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), ']] ', '• [{{fullurl:', IF (wp.page_namespace = 14, 'Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), '|action=edit}} edit] ', '→ [[:it:', REPLACE (iwl_title, '_', ' '), ']]') AS wikipage FROM iwlinks INNER JOIN page wp ON wp.page_id = iwl_from AND wp.page_namespace IN (0, 14) INNER JOIN itwiki_p.page cp ON cp.page_title = iwl_title AND cp.page_namespace = 0 AND cp.page_is_redirect = 1 WHERE iwl_prefix IN ('it') AND iwl_title LIKE 'Categoria:%' ) UNION #external links to article redirects (SELECT CONCAT('# [[', IF (wp.page_namespace = 14, ':Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), ']] ', '• [{{fullurl:', IF (wp.page_namespace = 14, 'Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), '|action=edit}} edit] ', '→ [[:it:', REPLACE (cp.page_title, '_', ' '), ']]') AS wikipage FROM externallinks INNER JOIN page wp ON wp.page_id = el_from AND wp.page_namespace IN (0, 14) INNER JOIN itwiki_p.page cp ON cp.page_title = SUBSTRING(REPLACE (el_to, CONCAT('?uselang=', @l), ''), IF ((LEFT (el_to, 5) = 'https'), @lenit + 1, @lenit)) AND cp.page_namespace = 0 AND cp.page_is_redirect = 1 WHERE ((el_to LIKE 'https://it.wikipedia.org/wiki/%') OR (el_to LIKE 'http://it.wikipedia.org/wiki/%')) AND el_to LIKE '%//it.wikipedia.org/wiki/Categoria:%' AND el_to NOT LIKE '%\%%' #temp ) UNION # nlwiki #interwiki links to article redirects (SELECT CONCAT('# [[', IF (wp.page_namespace = 14, ':Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), ']] ', '• [{{fullurl:', IF (wp.page_namespace = 14, 'Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), '|action=edit}} edit] ', '→ [[:nl:', REPLACE (iwl_title, '_', ' '), ']]') AS wikipage FROM iwlinks INNER JOIN page wp ON wp.page_id = iwl_from AND wp.page_namespace IN (0, 14) INNER JOIN nlwiki_p.page cp ON cp.page_title = iwl_title AND cp.page_namespace = 0 AND cp.page_is_redirect = 1 WHERE iwl_prefix IN ('nl') AND iwl_title LIKE 'Categorie:%' ) UNION #external links to article redirects (SELECT CONCAT('# [[', IF (wp.page_namespace = 14, ':Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), ']] ', '• [{{fullurl:', IF (wp.page_namespace = 14, 'Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), '|action=edit}} edit] ', '→ [[:nl:', REPLACE (cp.page_title, '_', ' '), ']]') AS wikipage FROM externallinks INNER JOIN page wp ON wp.page_id = el_from AND wp.page_namespace IN (0, 14) INNER JOIN nlwiki_p.page cp ON cp.page_title = SUBSTRING(REPLACE (el_to, CONCAT('?uselang=', @l), ''), IF ((LEFT (el_to, 5) = 'https'), @lennl + 1, @lennl)) AND cp.page_namespace = 0 AND cp.page_is_redirect = 1 WHERE ((el_to LIKE 'https://nl.wikipedia.org/wiki/%') OR (el_to LIKE 'http://nl.wikipedia.org/wiki/%')) AND el_to LIKE '%//nl.wikipedia.org/wiki/Categorie:%' AND el_to NOT LIKE '%\%%' #temp ) UNION # ruwiki #interwiki links to article redirects (SELECT CONCAT('# [[', IF (wp.page_namespace = 14, ':Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), ']] ', '• [{{fullurl:', IF (wp.page_namespace = 14, 'Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), '|action=edit}} edit] ', '→ [[:ru:', REPLACE (iwl_title, '_', ' '), ']]') AS wikipage FROM iwlinks INNER JOIN page wp ON wp.page_id = iwl_from AND wp.page_namespace IN (0, 14) INNER JOIN ruwiki_p.page cp ON cp.page_title = iwl_title AND cp.page_namespace = 0 AND cp.page_is_redirect = 1 WHERE iwl_prefix IN ('ru') AND iwl_title LIKE 'Категория:%' ) UNION #external links to article redirects (SELECT CONCAT('# [[', IF (wp.page_namespace = 14, ':Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), ']] ', '• [{{fullurl:', IF (wp.page_namespace = 14, 'Kategorie:', ''), REPLACE (wp.page_title, '_', ' '), '|action=edit}} edit] ', '→ [[:ru:', REPLACE (cp.page_title, '_', ' '), ']]') AS wikipage FROM externallinks INNER JOIN page wp ON wp.page_id = el_from AND wp.page_namespace IN (0, 14) INNER JOIN ruwiki_p.page cp ON cp.page_title = SUBSTRING(REPLACE (el_to, CONCAT('?uselang=', @l), ''), IF ((LEFT (el_to, 5) = 'https'), @lenru + 1, @lenru)) AND cp.page_namespace = 0 AND cp.page_is_redirect = 1 WHERE ((el_to LIKE 'https://ru.wikipedia.org/wiki/%') OR (el_to LIKE 'http://ru.wikipedia.org/wiki/%')) AND el_to LIKE '%//ru.wikipedia.org/wiki/Категория:%' AND el_to NOT LIKE '%\%%' #temp ) ORDER BY wikipage LIMIT 1000;
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...