开发者

MYSQL - Quoted table / field names vs unquoted names

I basically always leave row and table names unquoted in my MYSQL queries - it's never caused me a problem, and I find it more readable. However, I have noticed that some people keep them enclosed in backticks.

So, what's the difference between a quoted table name and an unquoted? Any advantages / disadvantages? Are there 开发者_JAVA技巧situations where you might need to enclose a name in quotes?


An identifier (such as a table, index, column, alias, view, stored procedure, partition, and other object names) may be quoted or unquoted. If an identifier contains special characters or is a reserved word, you must quote it whenever you refer to it. (reference Schema Object Names)


I didn't see it in the other topic very quick: I've seen a database that had a field named "order". Now you'll get a syntax error if you use that without backticks, as it is a reserved word (as in ORDER BY )

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜