Reputation: 1
yesterday I stumbled upon a weird problem.
I have a PHP script that creates mysql databases for me based of some input.
When the script tried to generate a database with the name "9e1617bafr1_1" (without quotes) and I got this error "MySQL Error 1064: You have an error in your SQL syntax".
Query is CREATE DATABASE IF NOT EXISTS 9e1617bafr1_1
I also get the error when trying to execute it on https://de.piliapp.com/mysql-syntax-check/ and http://sqlfiddle.com/
I resolved it by using backticks before and after the database name but I'm still wondering why I got this error in the first place as the creation of "9d1617bafr1_1", "9f1617bafr1_1" and so on worked flawlessly.
Unfortunately I did not find anything useful on this behavior on the internet and as I'm very curious about it I wanted to ask if anybody know if this is a reserved word or if it violates the SQL standard in any way?
Upvotes: 0
Views: 39
Reputation: 3171
9e1617bafr1_1 is parsed as number (9e1617) followed by a character string (bafr1_1). Your other attempts, "9d1617bafr1_1", and "9f1617bafr1_1", don't start with scientific notation, so they don't get parsed that way.
Upvotes: 2