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,560
  • 3
  • 48
  • 51
  • possible duplicate of [Using backticks around field names](http://stackoverflow.com/questions/261455/using-backticks-around-field-names) – Joe Stefanelli Jan 20 '11 at 19:04

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,865
  • 3
  • 29
  • 32
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
  • 64,065
  • 16
  • 119
  • 163