3

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 situations where you might need to enclose a name in quotes?

Sam Dufel
  • 17,084
  • 3
  • 46
  • 49

2 Answers2

2

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)

RDL
  • 7,737
  • 3
  • 28
  • 31
0

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 )

Nanne
  • 63,347
  • 16
  • 116
  • 159