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
Akaibu
.
Toggle Highlighting
SQL
SELECT page.page_id, LEFT(page.page_title, 50) AS page_title, page.page_len, link_data.internal_link_count, CASE WHEN IFNULL(link_data.internal_link_count, 0) > 0 THEN page.page_len / link_data.internal_link_count ELSE NULL -- or you can choose to return 0 instead of NULL if preferred END AS ratio FROM page -- LEFT JOIN to exclude disambiguation pages LEFT JOIN page_props ON page.page_id = page_props.pp_page AND page_props.pp_propname = 'disambiguation' -- LEFT JOIN to get internal link count data LEFT JOIN ( SELECT pl_from AS page_id, COUNT(*) AS internal_link_count FROM pagelinks GROUP BY pl_from ) AS link_data ON link_data.page_id = page.page_id -- LEFT JOIN to exclude 'All set index articles' category LEFT JOIN categorylinks cl ON page.page_id = cl.cl_from AND cl.cl_to = 'All_set_index_articles' WHERE page.page_namespace = 0 AND page_is_redirect = 0 AND page.page_id < 20000000 AND page_props.pp_page IS NULL -- Exclude disambiguation pages AND cl.cl_from IS NULL -- Exclude pages in 'All set index articles' AND page.page_len > 0 -- Avoid division by zero GROUP BY page.page_id ORDER BY ratio DESC;
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...