Finding all Basic Pages not referenced by a main-menu entry
I had to wrap the cast in a TRIM function:

drush @[redacted] sqlq "SELECT nid, title FROM node WHERE node.type = 'page' AND node.status = 1 AND (node.language = 'und' OR node.language = 'en') AND CONCAT('node/', TRIM(CAST(node.nid AS CHAR(7)))) NOT IN (SELECT link_path FROM menu_links WHERE menu_links.menu_name = 'main-menu') ORDER BY nid"