When to use single quotes, double quotes, and backticks in MySQL
Asked 07 September, 2021
Viewed 1.7K times
  • 62

I am trying to learn the best way to write queries. I also understand the importance of being consistent. Until now, I have randomly used single quotes, double quotes, and backticks without any real thought.


$query = 'INSERT INTO table (id, col1, col2) VALUES (NULL, val1, val2)';

Also, in the above example, consider that table, col1, val1, etc. may be variables.

What is the standard for this? What do you do?

I've been reading answers to similar questions on here for about 20 minutes, but it seems like there is no definitive answer to this question.

13 Answer