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

SQL

AخA
 
WITH p1 AS
(
  SELECT REPLACE(page_title, '_', ' ') AS title,
         page_is_redirect AS is_redirect,
         REGEXP_REPLACE(REPLACE(page_title, '_', ' '),
                        '(\\w, (?:\\w| )+),( (?:and|or) \\w)',
                        '\\1\\2') AS comma_removed
  FROM page
  WHERE page_namespace = 0
    AND REPLACE(page_title, '_', ' ') REGEXP '\\w, (?:\\w| )+, (?:and|or) \\w'
)
SELECT p1.*,
       CASE
         WHEN page_id IS NULL THEN 'doesn''t exist'
         WHEN page_is_redirect = 1 THEN 'redirect'
         ELSE 'non-redirect'
       END AS comma_removed_status
FROM p1
LEFT JOIN page ON page_namespace = 0 AND page_title = REPLACE(comma_removed, ' ', '_')
ORDER BY title ASC;
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...