Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
Fork of
Harvest external-ids from external links
by
Matěj Suchánek
This query is marked as a draft
This query has been published
by
SR5
.
Toggle Highlighting
SQL
USE eswiki_p; SELECT pp_value, "P2987", CONCAT( '"', SUBSTRING_INDEX( REPLACE( REPLACE( el_to, "http://www.taekwondodata.com/", "" ), "http://www.taekwondodata.com/", "" ), "/", 1 ), '"' ) AS id, "S143", "Q8449" FROM (SELECT * FROM externallinks WHERE (el_to LIKE "http://www.taekwondodata.com/%" OR el_to LIKE "https://www.taekwondodata.com/%") AND el_to NOT LIKE "%/article/%" AND el_to NOT LIKE "%/discover/%" AND el_to NOT LIKE "%?%") AS el JOIN (SELECT * FROM page WHERE page_namespace = 0) AS pages ON pages.page_id = el_from JOIN (SELECT * FROM page_props WHERE pp_propname = "wikibase_item") AS props ON pp_page = pages.page_id JOIN (SELECT * FROM wikidatawiki_p.page WHERE page_namespace = 0) AS wd ON wd.page_title = pp_value WHERE wd.page_id NOT IN ( SELECT pl_from FROM wikidatawiki_p.pagelinks WHERE pl_namespace = 120 AND pl_title = "P2987" AND pl_from_namespace = wd.page_namespace ) #AND pages.page_title NOT LIKE "%album%" #AND pages.page_title NOT LIKE "%song%" #AND pages.page_title NOT LIKE "%discography%" #AND pages.page_title NOT LIKE "List%" # pl_title IN ("Q11424", "Q15416", "Q24862", "Q202866", "Q5398426") GROUP BY pages.page_title HAVING COUNT(DISTINCT id) = 1;
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...