Wikipedia:WikiProject Red Link Recovery/SQL scraps

Unlikely links
// Mismatched brackets (cheeky method of counting how many x's in string 'xuxtlkx')

SELECT page_title, orig FROM page, crushed_links WHERE length(replace(orig, '(', )) <> length(replace(orig, ')', )) AND id = page_id AND page_namespace = 0;

// Mismatched quotes, excluding " used to represent inches SELECT page_title, orig FROM page, crushed_links WHERE (length(orig) - length(replace(orig, '\"', '')) ) mod 2 = 1 AND orig NOT REGEXP '[0-9]"' AND id = page_id AND page_namespace = 0;

// Pick out long red links SELECT f.page_title, orig, FROM  page f, crushed_links WHERE f.page_id = crushed_links.id AND    f.page_namespace = 0 AND length( orig ) > 200;

// Pick out red links matching XXX REPLACE INTO suggestions SELECT f.page_title, orig, orig FROM  page f, crushed_links WHERE f.page_id = crushed_links.id AND    f.page_namespace = 0 AND   orig REGEXP "[Qq][^Uu]";