From the course: MySQL Essential Training (2019)

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Quote marks

Quote marks

- [Instructor] MySQL has a quirky history with quote marks, even in their attempts to support the standard, it remains quirky. So standard quote marks for a literal string in SQL look like this. Single quotes surrounding a literal string is the standard literal string in SQL. So when I execute this here in MySQL, you notice I get a expected result. I get the literal string, and that's fine. Now double quotes in standard SQL are for a different purpose, but you'll notice in MySQL they work just like this. Standard SQL has a literal string delimited by single quote marks, and double quote marks are used for special identifiers like column names and aliases. MySQL originally supported only double quotes for literal strings. While single quotes are supported in current versions, MySQL still needs to support the double quotes as a concession to legacy code, and there is a lot of legacy MySQL code that uses double quotes with literal strings. Now this becomes a problem when we do something…

Contents