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; SELECT first_names.term_text, first_names.epp_entity_id FROM ( SELECT term_text, epp_entity_id FROM (SELECT * FROM pagelinks WHERE pl_title IN ("Q3409032","Q12308941","Q11879590") AND pl_from_namespace = 0) AS pl1 JOIN wb_entity_per_page ON pl_from = epp_page_id JOIN (SELECT * FROM wb_terms WHERE term_type = "label" AND term_entity_type = "item") AS labels ON term_entity_id = epp_entity_id LEFT JOIN (SELECT * FROM pagelinks WHERE pl_title = "P1533" AND pl_namespace = 120) AS withoutP1533 ON withoutP1533.pl_from = epp_page_id WHERE withoutP1533.pl_title IS NULL ) AS first_names, ( SELECT term_text, epp_entity_id FROM (SELECT * FROM pagelinks WHERE pl_title = "Q101352" AND pl_from_namespace = 0) AS links JOIN wb_entity_per_page ON pl_from = epp_page_id JOIN (SELECT * FROM wb_terms WHERE term_type = "label" AND term_entity_type = "item") AS labels ON term_entity_id = epp_entity_id ) AS surnames WHERE surnames.term_text = first_names.term_text GROUP BY first_names.term_text HAVING COUNT(DISTINCT first_names.term_text) = 1 AND COUNT(DISTINCT surnames.term_text) = 1 ORDER BY first_names.term_text;
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...