SELECT * FROM table LIMIT1;
LIMIT1
This is taken as an SQL alias because LIMIT1
not a reserved SQL literal. Something after the table name and this is not a reserved keyword, which is always used as an alias of the SQL table.
SELECT * FROM table LIMIT 1;
When you used LIMIT
immediately after the table name, SQL detected this as a reserved keyword and worked on it according to the behavior. If you want to use reserved keywords in your query, you can do this by placing the reserved literals in quotation marks. as..
SELECT * FROM table `LIMIT`;
OR
SELECT * FROM table `LIMIT 1`;
Now all words related to quotes will be treated as custom. Usually we were mistaken with keywords of date, time, restriction, etc. using them as column names.
source share