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
Estimatio
.
Toggle Highlighting
SQL
-- Find all internal links pointing to non-existent pages and count how many times these pages are linked to SELECT non_existent_links.pl_target_id AS TargetPageID, COUNT(*) AS LinkCount FROM -- Subquery to get internal links pointing to non-existent pages (SELECT pl_target_id FROM pagelinks pl LEFT JOIN page p ON pl.pl_target_id = p.page_id WHERE p.page_id IS NULL -- Target page does not exist AND pl.pl_target_id IS NOT NULL -- Ensure the target ID is valid AND pl.pl_target_id != 0 -- Exclude any records with page ID 0 if that's the identifier for non-existent pages GROUP BY pl_target_id) AS non_existent_links JOIN pagelinks pl ON non_existent_links.pl_target_id = pl.pl_target_id WHERE pl.pl_from_namespace = 0 -- Assuming pages are in the main namespace GROUP BY non_existent_links.pl_target_id HAVING LinkCount > 0 -- Only include targets that are linked to more than 0 times ORDER BY LinkCount DESC LIMIT 10;
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...