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
Cryptic
.
From https://github.com/mzmcbride/database-reports/blob/main/dbreps2/src/enwiki/unusedtemplatesfiltered.rs Includes templates that are transcluded only by themselves. (Also tightens up the exclusions, by escaping underscores in the LIKE clauses.) For [[Wikipedia talk:Database reports#Wikipedia:Database reports/Unused templates (filtered) update related to Module:Pagetype]] circa 22 February 2024.
Toggle Highlighting
SQL
SELECT page_id, page_title FROM page LEFT JOIN linktarget ON page_namespace = lt_namespace AND page_title = lt_title LEFT JOIN templatelinks ON tl_target_id=lt_id AND tl_from <> page_id WHERE page_namespace = 10 AND page_is_redirect = 0 AND tl_target_id IS NULL AND page_title NOT LIKE "Adminstats/%" AND page_title NOT LIKE "AfC_%" AND page_title NOT LIKE "Cite_doi/%" AND page_title NOT LIKE "Cite_pmid/%" AND page_title NOT LIKE "Did_you_know_nominations/%" AND page_title NOT LIKE "Editnotices/%" AND page_title NOT LIKE "PBB/%" AND page_title NOT LIKE "POTD_caption/%" AND page_title NOT LIKE "POTD_credit/%" AND page_title NOT LIKE "POTD_protected/%" AND page_title NOT LIKE "TemplateStyles_sandbox/%" AND page_title NOT LIKE "TFA_title/%" AND page_title NOT LIKE "User_%" AND page_title NOT LIKE "%/testcases" AND page_title NOT LIKE "%/sandbox" AND page_title NOT LIKE "%/rater-data.js" AND page_title NOT LIKE "%-stub" AND page_title NOT IN ( SELECT page_title FROM page JOIN categorylinks ON page_id = cl_from WHERE cl_to IN ( 'Wikipedia_substituted_templates', 'Wikipedia_transclusionless_templates', 'Deprecated_templates_kept_for_historical_reasons', 'Inactive_project_pages', 'Parameter_shared_content_templates', 'Computer_language_user_templates', 'Language_user_templates', 'Template_test_cases', 'Template_sandboxes', 'Level-zero_userbox_templates', 'Templates_for_deletion' ) AND page_namespace = 10 ) ORDER BY p1.page_title ASC;
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...