MySQL Single Quotes, Double Quotes, Back Quotes Usage Explained

There’s a slight confusion and a big difference between enclosing a string with ‘, ” or ` when using MySQL commands, in this article, we’ll cover the main difference.

‘Single Quotes’:

Single Quotes are used for enclosing string literals, like when making an INSERT statement the VALUES() should be enclosed with them, for example:

INSERT INTO `table_name` VALUES ('value1.1', 'value1.2'), ('value2.1', 'value2.2');

`Back Quotes`:

Back Quotes are used to escape table names when their names are reserved words in the usual MySQL syntax, like PASSWORD for example:

cPanel Hosting from WebhostFace
INSERT INTO `users` (`username`, `password`) VALUES ('user1', 'hashed_password');

The only necessary usage of the Back Quotes in the above example is around the password as it’s a reserved word.

“Double Quotes”:

The Double Quotes can be used to mimic the functionality of the previously mentioned two depending on the MySQL server configuration that’s set.

You can try the most popular MySQL commands on our web hosting packages: Shared Hosting, SSD VPS Hosting, Dedicated Servers.