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
Solidest
.
Toggle Highlighting
SQL
SELECT CONCAT('[[Шаблон:', p.page_title, ']]') AS template_name, COUNT(DISTINCT lt.lt_title) AS total_links, COUNT(DISTINCT CASE WHEN p2.page_id IS NULL THEN lt.lt_title END) AS red_links, ROUND(COUNT(DISTINCT CASE WHEN p2.page_id IS NULL THEN lt.lt_title END) * 100.0 / COUNT(DISTINCT lt.lt_title), 2) AS red_links_percentage FROM page p JOIN templatelinks tl ON tl.tl_from = p.page_id JOIN linktarget tlt ON tlt.lt_id = tl.tl_target_id JOIN pagelinks pl ON pl.pl_from = p.page_id JOIN linktarget lt ON lt.lt_id = pl.pl_target_id LEFT JOIN page p2 ON p2.page_namespace = lt.lt_namespace AND p2.page_title = lt.lt_title WHERE p.page_namespace = 10 AND p.page_title NOT LIKE '%/doc' AND tlt.lt_title IN ( 'Навигационная_таблица_с_блоками', 'Навигационная_таблица_с_колонками', 'Боковая_навигационная_таблица', 'Боковая_навигационная_таблица_с_блоками', 'Навигационная_обёртка', 'Навигационная_полоса', 'Навигационная_таблица', 'Навигационный_блок', 'Подгруппы_навигационной_таблицы' ) AND tlt.lt_namespace = 10 AND lt.lt_namespace != 14 -- Исключаем ссылки на категории GROUP BY p.page_id, p.page_title HAVING COUNT(DISTINCT lt.lt_title) > 0 AND COUNT(DISTINCT CASE WHEN p2.page_id IS NULL THEN lt.lt_title END) > 0 AND COUNT(DISTINCT lt.lt_title) <= 1000 AND (COUNT(DISTINCT lt.lt_title) - COUNT(DISTINCT CASE WHEN p2.page_id IS NULL THEN lt.lt_title END)) <= 1 ORDER BY red_links_percentage DESC, red_links 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...