I need to search for data in MYSQL table with JSON data. Using JSON_EXTRACT(@json, "$.link") LIKE '%http%'
works as expected. But LIKE 'http%' or '%http'
dosn't!
Does it means JSON_EXTRACT cant't be used with single wildcard select matching?
EXAMPLE:
This is my JSON
set @json = '{"link": "https://www.google.com"}' ;
select JSON_EXTRACT(@json, "$.link") like '%com';
-- returns 0
select JSON_EXTRACT(@json, "$.link") like 'http%' ;
-- returns 0
select JSON_EXTRACT(@json, "$.link") like '%google%' ;
select JSON_EXTRACT(@json, "$.link") like '%http%' ;
select JSON_EXTRACT(@json, "$.link") like '%com%' ;
-- returns 1 !
And here are an example in Fiddle: https://www.db-fiddle.com/f/7yPvfa2UZsZLdYSxdsnecx/0