- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to insert records with double quotes in MySQL?
To insert records with double quotes, use the backslash (\) as in the below syntax −
Syntax
insert into yourTableName values('\"yourValue\"');
Let us first create a table −
mysql> create table DemoTable -> ( -> Name varchar(20) -> ); Query OK, 0 rows affected (0.63 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values('\"John\"'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('\"Chris\"'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('\"Adam Smith\"'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('\"Carol\"'); Query OK, 1 row affected (0.20 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output. The double quotes around the records can be easily seen −
+--------------+ | Name | +--------------+ | "John" | | "Chris" | | "Adam Smith" | | "Carol" | +--------------+ 4 rows in set (0.00 sec)
- Related Articles
- Find records with double quotes in a MySQL column?
- How to insert date in single quotes with MySQL date formats?
- How to print double quotes with the string variable in Python?
- How to prevent MySQL double insert (duplicate entry)?
- Single quotes vs. double quotes in C or C++
- How to add a string containing double quote to records in MySQL?
- MySQL query to insert multiple records quickly
- Single and Double Quotes in Perl
- How to include quotes in comma separated column with MySQL?
- Insert records from multiple tables in MySQL
- The easiest way to insert date records in MySQL?
- How to escape single quotes in MySQL?
- Use UNION ALL to insert records in two tables with a single query in MYSQL
- Escaping quotes while inserting records in MongoDB?
- Is there a PHP function that only adds slashes to double quotes NOT single quotes

Advertisements