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
MisterSynergy
.
for https://www.wikidata.org/wiki/User:MisterSynergy/itemstats
Toggle Highlighting
SQL
-- https://www.mediawiki.org/wiki/Manual:Database_layout -- note: the page table does not contain Q-IDs that have been deleted (or never been created) USE wikidatawiki_p; -- number of redirects: use WQS -- number of empty items: use WQS -- total number of item in bin: (rest may have been deleted, or never created) SELECT CEILING(SUBSTRING(page_title FROM 2) / 500000) AS bin, COUNT(*) AS cnt FROM page WHERE page_namespace=0 GROUP BY bin ORDER BY bin ASC; -- number of items that have been deleted once (regardless of whether they have been restored): -- SELECT DISTINCT log_title FROM logging WHERE log_namespace=0 AND log_type='delete' -- pages that have been deleted, and not been restored -- SELECT DISTINCT log_title FROM logging WHERE log_namespace=0 AND log_type='delete' AND log_title NOT IN (SELECT page_title FROM page WHERE page_namespace=0) -- SELECT CEILING(SUBSTRING(log_title FROM 2) / 100000) AS bin, COUNT(*) AS cnt FROM logging WHERE log_namespace=0 AND log_type='delete' AND log_title NOT IN (SELECT page_title FROM page WHERE page_namespace=0) -- SELECT ?bin (COUNT(*) AS ?cnt) WHERE { -- #?item wikibase:statements 0 . -- #?item owl:sameAs [] . -- ?item wikibase:sitelinks [] . -- BIND(ceil(xsd:integer(SUBSTR(STR(?item),33)) / 100000) AS ?bin) . -- } GROUP BY ?bin ORDER BY ASC(?bin)
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...