Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL's different quote marks

Tags:

mysql

quotes

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.

like image 952
user963631 Avatar asked Dec 27 '11 08:12

user963631


2 Answers

With ` you write mysql variable names. With ' you write mysql variable values

For example

SELECT * FROM `test` WHERE `x` = '1'
like image 63
Narek Avatar answered Nov 24 '22 16:11

Narek


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.

like image 29
Stan Avatar answered Nov 24 '22 17:11

Stan