This query is marked as a draft This query has been published by Matěj Suchánek.

SQL

x
 
SELECT DISTINCT page_title, SUBSTRING_INDEX(page_title, '_(', 1) AS title, 1 AS page_exists, page_is_redirect
FROM page
WHERE page_namespace = 0 AND page_title LIKE '%\_(film)'
UNION
SELECT DISTINCT pl_title, SUBSTRING_INDEX(pl_title, '_(', 1) AS title, IF(page_title IS NULL, 0, 1) AS page_exists,
IF(page_is_redirect IS NULL, 0, page_is_redirect) AS is_redirect
FROM pagelinks
LEFT JOIN page ON page_title = pl_title AND page_namespace = pl_namespace
WHERE pl_namespace = 0 AND pl_title LIKE '%\_(film)';
SELECT DISTINCT page_title, SUBSTRING_INDEX(page_title, '_(', 1) AS title, 1 AS page_exists, page_is_redirect
FROM page
WHERE page_namespace = 0 AND page_title LIKE '%\_(film,%)'
UNION
SELECT DISTINCT pl_title, SUBSTRING_INDEX(pl_title, '_(', 1) AS title, IF(page_title IS NULL, 0, 1) AS page_exists,
IF(page_is_redirect IS NULL, 0, page_is_redirect) AS is_redirect
FROM pagelinks
LEFT JOIN page ON page_title = pl_title AND page_namespace = pl_namespace
WHERE pl_namespace = 0 AND pl_title LIKE '%\_(film,%)';
/*SELECT * FROM (
  SELECT DISTINCT SUBSTRING_INDEX(page_title, '_(', 1) AS title, 1 AS page_exists
  FROM page
  WHERE page_namespace = 0 AND page_title LIKE '%\_(film)'
  UNION
  SELECT DISTINCT SUBSTRING_INDEX(pl_title, '_(', 1) AS title, IF(page_title IS NULL, 0, 1) AS page_exists
  FROM pagelinks
  LEFT JOIN page ON page_title = pl_title AND page_namespace = pl_namespace
  WHERE pl_namespace = 0 AND pl_title LIKE '%\_(film)'
) AS simple, (
  SELECT DISTINCT page_title, SUBSTRING_INDEX(page_title, '_(', 1) AS title, 1 AS page_exists
  FROM page
  WHERE page_namespace = 0 AND page_title LIKE '%\_(film,%)'
  UNION
  SELECT DISTINCT pl_title, SUBSTRING_INDEX(pl_title, '_(', 1) AS title, IF(page_title IS NULL, 0, 1) AS page_exists
  FROM pagelinks
  LEFT JOIN page ON page_title = pl_title AND page_namespace = pl_namespace
  WHERE pl_namespace = 0 AND pl_title LIKE '%\_(film,%)'
) AS complex
WHERE simple.title = complex.title
LIMIT 1;*/
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...