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
Abhinavmohandas
.
Toggle Highlighting
SQL
-- Count pages in the page table SELECT 'page' AS table_name, COUNT(*) AS total_count FROM page WHERE EXISTS ( SELECT 1 FROM revision WHERE revision.rev_page = page.page_id AND rev_timestamp <= 'YYYYMMDDHHMMSS' ) UNION ALL -- Count entries in the category table (example of another relevant table) SELECT 'category' AS table_name, COUNT(*) AS total_count FROM category WHERE EXISTS ( SELECT 1 FROM page WHERE page.page_id = category.cat_id AND page.page_namespace IN (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) AND EXISTS ( SELECT 1 FROM revision WHERE revision.rev_page = page.page_id AND rev_timestamp <= 'YYYYMMDDHHMMSS' ) ) UNION ALL -- Count entries in other tables SELECT 'templatelinks' AS table_name, COUNT(*) AS total_count FROM templatelinks WHERE EXISTS ( SELECT 1 FROM page WHERE page.page_id = templatelinks.tl_from AND page.page_namespace IN (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) AND EXISTS ( SELECT 1 FROM revision WHERE revision.rev_page = page.page_id AND rev_timestamp <= 'YYYYMMDDHHMMSS' ) ); -- Add similar SELECT statements for other relevant tables here -- Example of combining results to get the total count SELECT SUM(total_count) AS total_pages FROM ( -- Your combined queries above ) AS combined_counts;
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...