MySQL Forums
Forum List  »  InnoDB

Re: LIKE not working as expected
Posted by: Peter Brawley
Date: April 19, 2020 10:38AM

To show no backslashes, insert 1, to show 1 insert 2, to show 2 insert 4, &c ...

select version(), @@sql_mode;
+-----------+--------------------------------------------+
| version() | @@sql_mode                                 |
+-----------+--------------------------------------------+
| 8.0.19    | STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION |
+-----------+--------------------------------------------+
drop table if exists data;
create table data( stringvalue varchar(32) );
insert into data set stringvalue="Thor\'s Hammer";
insert into data set stringvalue="Thor\\'s Hammer";
select * from data;
+----------------+
| stringvalue    |
+----------------+
| Thor's Hammer  |
| Thor\'s Hammer |
+----------------+
select * from data WHERE stringValue = "Thor\'s Hammer";
+---------------+
| stringvalue   |
+---------------+
| Thor's Hammer |
+---------------+
select * from data WHERE stringValue = "Thor\\'s Hammer";
+----------------+
| stringvalue    |
+----------------+
| Thor\'s Hammer |
+----------------+

Options: ReplyQuote


Subject
Views
Written By
Posted
153
April 18, 2020 08:37PM
Re: LIKE not working as expected
54
April 19, 2020 10:38AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.