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
Zaher kadour
.
Toggle Highlighting
SQL
USE wikidatawiki_p; SELECT sitelink.ips_site_page AS category, CONCAT("Q",epp_entity_id) AS category_item, CONCAT("Q",term_entity_id) AS taxon_item, COUNT(items.ips_site_page) AS number_of_sitelinks /* FROM (SELECT * FROM pagelinks WHERE pl_title = "Q4167836" AND pl_from_namespace = 0) AS categories JOIN wb_entity_per_page AS epp1 ON epp1.epp_page_id = categories.pl_from JOIN (SELECT * FROM wb_items_per_site WHERE ips_site_id = "arwiki") AS sitelink ON sitelink.ips_item_id = epp1.epp_entity_id JOIN (SELECT * FROM wb_terms WHERE term_type IN ("label","alias") AND term_entity_type = "item") AS terms ON term_text = SUBSTRING_INDEX(sitelink.ips_site_page, ':', -1) JOIN wb_entity_per_page AS epp2 ON epp2.epp_entity_id = term_entity_id JOIN (SELECT * FROM pagelinks WHERE pl_title IN ("Q16521","Q310890") AND pl_from_namespace = 0) AS taxons ON taxons.pl_from = epp2.epp_page_id # JOIN wb_items_per_site AS items # ON items.ips_item_id = sitelink.ips_item_id*/ FROM (SELECT * FROM arwiki_p.page WHERE page_namespace = 14) AS categories JOIN (SELECT * FROM wb_terms WHERE term_type IN ("label","alias") AND term_entity_type = "item") AS terms ON page_title = term_text JOIN wb_entity_per_page ON epp_entity_id = term_entity_id JOIN (SELECT * FROM pagelinks WHERE pl_title IN ("Q16521","Q310890")) AS links ON links.pl_from = epp_page_id JOIN (SELECT * FROM wb_items_per_site WHERE ips_site_id = "arwiki") AS sitelink ON sitelink.ips_site_page = CONCAT("Kategorie:",term_text) JOIN wb_items_per_site AS items ON items.ips_item_id = sitelink.ips_item_id GROUP BY sitelink.ips_site_page HAVING COUNT(items.ips_site_page) < 4 ORDER BY COUNT(items.ips_site_page) DESC, 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...