tags:

views:

31

answers:

2

When seeing SQL code on the internet and in manuals there seems to vary a lot what is used to signify strings (or at least that's what I think they do?).

Are there any difference between using `, ´, ' or "? Are they all the same? Or do some of them have special meanings? Should some be used in certain cases and others in other cases? What is the deal here?

+1  A: 

`` delimits identifiers and ' and " delimits strings. there are no difference between last two

´ has no meaning in mysql

Col. Shrapnel
+2  A: 

Backticks (`) are required when identifiers, such as column names, are using names which also happen to be reserved words. For example, since from is a reserved word, you would have to wrap a from column name in backticks, as follows:

SELECT `from`, to FROM messages WHERE to = 'Joe';

Also note how the string in the WHERE clause had to be wrapped in quotes. This is also required.

Further reading:

Daniel Vassallo