sql-parser icon indicating copy to clipboard operation
sql-parser copied to clipboard

Aliases without AS keyword

Open nijel opened this issue 8 years ago • 1 comments

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

nijel avatar Jul 31 '17 13:07 nijel

Yes. That's right.

These SQL syntax are valid in MySQL.

And it should be fixed.

peter279k avatar Jun 04 '19 09:06 peter279k