问题
I am a bit new to MySQL and just wanted to know what is the difference between:
` ' "
when I'm using them in a query.
回答1:
With ` you write mysql variable names. With ' you write mysql variable values
For example
SELECT * FROM `test` WHERE `x` = '1'
回答2:
I would add that the way double quotes are interpreted depend of wether or not your MySQL server has ANSI quotes turned on or off.
In the former you cannot use double quotes as a string delimiter.
SELECT name FROM user WHERE last_name = "norris" ;
will return you a punch in your teeth.
回答3:
``quotes you dont need to escape where as string quotes you do ''single or ""double
回答4:
http://dev.mysql.com/doc/refman/5.1/en/string-literals.html
http://dev.mysql.com/doc/refman/5.1/en/identifiers.html
回答5:
use ` (backquotes) for column name
use ' or " for values
Don't use backticks with column values. use either single or double quotes otherwise mysql considered that value as a column name.
来源:https://stackoverflow.com/questions/8642644/mysqls-different-quote-marks