I wanted to let our CI system syntax-check SQL files, but failed to find a SQL syntax checker for the command line. There are many online tools to which you can copy&paste your SQL statements, but nobody wants this.
It's a standalone .phar file that you can use to check the syntax of SQL files:
$ php-sqllint tests/files/create-missingcomma.sql Checking SQL syntax of tests/files/create-missingcomma.sql Line 3, col 5 at "pid": A comma or a closing bracket was expected. Line 3, col 13 at "11": Unexpected beginning of statement. Line 3, col 17 at "DEFAULT": Unrecognized statement type.
$ echo 'SELECT title FROM tools WHERE domain="SQL" LIMIT 1'\ | php-sqllint --format --highlight html - SELECT title FROM tools WHERE domain = "SQL" LIMIT 1