cweiske.de: tools: PHP-SQLlint
"Command line tool to validate (syntax check) SQL files. Primarily for MySQL .sql files.
Can be used in git pre-commit hooks to catch errors. Use it from your shell, offline and without any SQL server.
You can also use it to format SQL queries."