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
Matěj Suchánek
.
Toggle Highlighting
SQL
USE wikidatawiki_p; # DESCRIBE wb_terms; /*SELECT CONCAT("Q",epp1.epp_entity_id), links1.pl_title, terms1.term_text#, CONCAT("Q",epp2.epp_entity_id), terms2.term_text FROM pagelinks AS links1 JOIN wb_entity_per_page AS epp1 ON epp1.epp_page_id = links1.pl_from LEFT JOIN pagelinks AS links3 ON links3.pl_from = epp1.epp_page_id AND links3.pl_title = "P1533" JOIN wb_terms AS terms1 ON terms1.term_entity_id = epp1.epp_entity_id CROSS JOIN wb_terms AS terms2 ON terms2.term_text = terms1.term_text # JOIN wb_entity_per_page AS epp2 # ON epp2.epp_page_id = terms2.term_entity_id # JOIN pagelinks AS links2 # ON links2.pl_from = epp2.epp_page_id AND links2.pl_title = "Q101352" WHERE links1.pl_title IN ("Q202444","Q12308941","Q11879590")# AND links2.pl_from IS NULL GROUP BY epp1.epp_entity_id HAVING COUNT(DISTINCT terms1.term_text) = 1 #AND COUNT(DISTINCT terms2.term_text) = 1 LIMIT 100; */ SELECT * FROM wb_entity_per_page AS epp1 JOIN pagelinks AS links1 ON epp1.epp_page_id = links1.pl_from AND links1.pl_title IN ("Q202444","Q12308941","Q11879590") JOIN wb_terms AS terms1 ON terms1.term_entity_id = epp1.epp_entity_id AND terms1.term_type = "label" CROSS JOIN wb_terms AS terms2 ON terms2.term_text = terms1.term_text AND terms1.term_type = "label" # JOIN pagelinks AS links2 # ON links2.pl_title = "Q101352" # WHERE NOT EXISTS ( # SELECT * FROM pagelinks AS links3 WHERE links3.pl_from = epp1.epp_page_id AND links3.pl_title = "P1533" # ) GROUP BY epp1.epp_entity_id LIMIT 100;
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...