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 "Шаблон", COUNT(DISTINCT lt.lt_id) AS "Всего ссылок", COUNT(DISTINCT CASE WHEN p2.page_id IS NULL THEN lt.lt_id END) AS "Красных ссылок", ROUND(COUNT(DISTINCT CASE WHEN p2.page_id IS NULL THEN lt.lt_id END) * 100.0 / COUNT(DISTINCT lt.lt_id), 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 = 0 GROUP BY p.page_id, p.page_title HAVING COUNT(DISTINCT lt.lt_id) > 0 AND COUNT(DISTINCT CASE WHEN p2.page_id IS NULL THEN lt.lt_id END) > 0 AND COUNT(DISTINCT lt.lt_id) <= 1000 AND (COUNT(DISTINCT lt.lt_id) - COUNT(DISTINCT CASE WHEN p2.page_id IS NULL THEN lt.lt_id END)) <= 1 ORDER BY red_links_percentage DESC, "Всего ссылок" 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...