From the course: MySQL Essential Training

Unlock this course with a free trial

Join today to access over 23,200 courses taught by industry experts.

Quote marks

Quote marks

- [Bill] Hi, I'm Bill Wyman. MySQL has a quirky history with quote marks and even in their attempts to support the standard, it remains quirky. So in standard SQL, use single quotes to quote a string. So you say 'this is a string' and execute that, and that works in current versions of MySQL. In older versions of MySQL, that did not work. MySQL required double quotes and it still supports double quotes as a concession to legacy code. So when I execute this with the double quotes, it works exactly the same. The problem is that double quote marks in standard SQL are used for special identifiers like column names and aliases. So if we USE scratch here to open the scratch database, and I'll select two columns from the customer table, name and address. Now in standard SQL, this is how you do this. If you want to quote your column names, and you don't have to if they're single words, but if you have spaces or special characters in your column names, you need to use quotes. So, this in…

Contents