0

I'm running into a strange problem with mysql does not like my table name.

mysql> DROP TABLE IF EXISTS 6e0OU1QgkU7Pj6ycQF0U_results;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '6e0OU1QgkU7Pj6ycQF0U_results' at line 1

mysql> DROP TABLE IF EXISTS 6epGz4xKzfKd6A9e1ASP_results;
Query OK, 0 rows affected (0.00 sec)

mysql>

Any idea why the first query has a syntax error while the second query is allowed?

2 Answers 2

5

It's probably the 6e0, which the SQL parser thinks is a number in scientific notation: 6 * 100.

Sign up to request clarification or add additional context in comments.

2 Comments

this sounds like a more probable answer
This is probably right, but no solution is provided...I think using quotes as Abhik suggested is probably the correct solution!
2

Thats because mysql does not recognize the table name since it starts with a digit MeN

Identifiers may begin with a digit but unless quoted may not consist solely of digits.

https://dev.mysql.com/doc/refman/5.0/en/identifiers.html

It is recommended that you do not use names that begin with Me or MeN, where M and N are integers. For example, avoid using 1e as an identifier, because an expression such as 1e+3 is ambiguous. Depending on context, it might be interpreted as the expression 1e + 3 or as the number 1e+3.

You can try as

DROP TABLE IF EXISTS `6e0OU1QgkU7Pj6ycQF0U_results`;

3 Comments

This answer is incorrect, which is apparent as the second example works. Also, the text you quote directly contradicts your assertion.
The reson is you can not use the identifier begins as MeN where M and N are digit.
I think the quotes will solve the issue but not for the reason that this answer states. This portion is irrelevant, "Identifiers may begin with a digit but unless quoted may not consist solely of digits."...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.