Fork of
Moscow metro lost pages
by IKhitron
This query is marked as a draft
This query has been published
by IKhitron.
SQL
x
set @page = /*10099658; # Петербург*/ 10111743;
set @template = /*21855; # Петербург*/ 44105;
# Код бота
# Первый запрос
select replace(lt_title, '_', ' ') as 'a' from pagelinks join linktarget
on pl_target_id = lt_id
where pl_from = @page
and not lt_namespace
and not lt_title in
(select page_title from page
where page_id in
(select tl_from from templatelinks
where tl_target_id = @template)
and not page_namespace)
and not exists
(select * from page
where page_title = lt_title
and page_namespace = lt_namespace
and page_is_redirect
and replace(page_title, '_', ' ') in ('пустой список'));
# Второй запрос
select replace(page_title, '_', ' ') as 'a' from page
where replace(page_title, '_', ' ') in ('пустой список')
and not page_namespace
and not (page_is_redirect
and exists
(select * from pagelinks join linktarget
on pl_target_id = lt_id
where pl_from = @page
and not lt_namespace
and lt_title = page_title));
# Третий запрос
select replace(page_title, '_', ' ') as a from page
where page_id in
(select tl_from from templatelinks
where tl_target_id = @template)
and not page_namespace
and not page_title in
(select lt_title from pagelinks join linktarget
where pl_target_id = lt_id
and pl_from = @page
and not lt_namespace)
and not replace(page_title, '_', ' ') in ('Петербургский метрополитен', 'Адмиралтейская (станция метро, Невско-Василеостровская линия)',
'Кольцевая линия (Санкт-Петербург)', 'Шуваловский проспект (станция метро)', 'Дачное (станция метро)',
'Адмиралтейско-Охтинская линия', 'Гавань (станция метро)');
# Четвёртый запрос
select replace(page_title, '_', ' ') as a from page
where replace(page_title, '_', ' ') in ('Петербургский метрополитен', 'Адмиралтейская (станция метро, Невско-Василеостровская линия)',
'Кольцевая линия (Санкт-Петербург)', 'Шуваловский проспект (станция метро)', 'Дачное (станция метро)',
'Адмиралтейско-Охтинская линия', 'Гавань (станция метро)')
and not page_namespace
and (not page_id in
(select tl_from from templatelinks
where tl_target_id = @template)
or page_title in
(select lt_title from pagelinks join linktarget
where pl_target_id = lt_id
and pl_from = @page
and not lt_namespace));
select * from page
where page_id = 10111743
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.