Find records with double quotes in a MySQL column?


Use LIKE to find records with double quotes. Following is the syntax −

select *from yourTableName where yourColumnName LIKE '%"%';

Let us first create a table −

mysql> create table DemoTable740 (Value varchar(100));
Query OK, 0 rows affected (0.49 sec)

Insert some records in the table using insert command −

mysql> insert into DemoTable740 values("\"");
Query OK, 1 row affected (0.18 sec)
mysql> insert into DemoTable740 values("\"John");
Query OK, 1 row affected (0.11 sec)
mysql> insert into DemoTable740 values("Sam");
Query OK, 1 row affected (0.12 sec)

Display all records from the table using select statement −

mysql> select *from DemoTable740;

This will produce the following output -

+-------+
| Value |
+-------+
| "     |
| "John |
| Sam   |
+-------+
3 rows in set (0.00 sec)

Here is the query to find records with double quotes in MySQL−

mysql> select *from DemoTable740 where Value LIKE '%"%';

This will produce the following output -

+-------+
| Value |
+-------+
| "     |
| "John |
+-------+
2 rows in set (0.00 sec)

Updated on: 22-Aug-2019

606 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements