This query is marked as a draft This query has been published by IKhitron.

SQL

x
 
use hewiki_p;
select replace(page_title, "_", " ") as name_of_the_template_with_flag from page
where page_namespace = 10
and page_title like "דגל/%"
and page_is_redirect = 0
and not exists
(select * from categorylinks
 where cl_from = page_id
 and replace(cl_to, "_", " ") in ("תבניות - דגלים של מדינות", "תבניות - מחתרות וארגונים צבאיים למחצה",
                                  "תבניות - סמלים של צבאות"));
select page_title, count(tl_from) from page inner join templatelinks
on page_title = tl_title
and page_namespace = tl_namespace
where page_namespace = 10
and page_title like "דגל/%"
and tl_from_namespace in (0, 10)
group by page_title;
select page_title, 0 from page
where page_namespace = 10
and page_is_redirect = 0
and page_title like "דגל/%"
and not exists
(select * from templatelinks
 where page_title = tl_title
and page_namespace = tl_namespace
and tl_from_namespace in (0, 10)
and not
(tl_from_namespace = 10
 and tl_from = page_id))
By running queries you agree to the Cloud Services Terms of Use and you irrevocably agree to release your SQL under CC0 License.
All SQL code is licensed under CC0 License.

Checking query status...