Possible Duplicate:
Using backticks around field names
What are the differences between backtick and single quote? Can I use IF statement in a query as above?
I just spend a long time figuring out an issue i had qith an sql query and i wanted some more information as i cant seem to find any information on the topic elsewhere.
I had a query
INSERT INTO prep_items ('id' ,'description' ,'price' ,'gst' ,'job' ,'stores' ,'item_number' ,'decimal')
VALUES ('NULL', 'TESTPRODUCT', '22.99', '1', 'PK', 'AB', '666', '1'
);
however this kept returning a syntax error with the query. After racking my brain for a while and comparing the query to the query that phpmyadmin generates to insert to the db i noticed that the apostrophes in the field name were actually ` the symbol on the same key as the tilda (~).
What is the difference between the two symbols? And where should the ` be used as opposed to the ‘ (apostrophe).
Thanks in advance.
(i also noticed that if i change the ”s to ` in the values list i get an error saying unknown collumn ‘valuename’ which leads me to believe it is only for the column list, but where can i find more information?)
Thanks again
The backtick
`quotes identifiers such as table names and column names. It is usually optional to quote identifiers, but it is necessary if the name contains special characters (e.g. spaces) or if the name is a reserved word (e.g.desc).The single quote
'delimits string literals.