Search code examples
mysqlstringquotesinsertion

Insert simple + double quote MySQL


Considering this table

CREATE TABLE name
( nom VARCHAR(255))

How could i insert a string with simple + double quote like : 'it's a "string"' inside my table

Insert into name values (`it's "string"`) 

This doesn't work actually. Thanks for suggestions.


Solution

  • You can use ' as string delimiters and backslash to escape special chars:

    Insert into name values ('it\'s \"string\"')