Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple strings in LIKE condition - Presto SQL

Tags:

sql

presto

I want to query a column in my table using a LIKE condition and this works fine-

select * from my_table where my_column LIKE '%hello%';

But, how do I query this column with multiple strings in my LIKE condition? Looking for something like-

select * from my_table where my_column LIKE ['%hello%'|'example%'|'%random%'|'%demo'];
like image 500
kev Avatar asked Mar 26 '26 12:03

kev


1 Answers

Use regexp_like():

select *
from my_table
where regexp_like(my_column, 'hello|example|random|demo');
like image 174
Gordon Linoff Avatar answered Mar 28 '26 02:03

Gordon Linoff