sql-parser
sql-parser copied to clipboard
Aliases without AS keyword
Having the AS keyword in the select expression is option, following both should work:
SELECT 1 AS name;
SELECT 1 name;
But the shorter variant fails:
$ ./bin/lint-query --query 'SELECT 1 name'
#1: Unrecognized keyword. (near "name" at position 9)
MySQL docs: https://dev.mysql.com/doc/refman/5.7/en/select.html#idm139723195268992
See also https://github.com/phpmyadmin/phpmyadmin/issues/13541
Yes. That's right.
These SQL syntax are valid in MySQL.
And it should be fixed.