On 12/5/2016 10:19 AM, Igor Tandetnik wrote:
On 12/5/2016 7:30 AM, ravi.shan...@cellworksgroup.com wrote:
select name from employee table where name like '%Araya%' or name like
'%Amul%' or name like '%Aj%';

Table - Employee

Id |     Name     | age |
1  | Arayan Kuma | 29  |
2  | Amul Kanth  | 30  |
3  | Ajay Kumar     | 45  |

I dont like to use may or conditions for pattern matching using like
operator.
Is there any other way I can workaround without using or condition in
like operator in sqlite.

WHERE length(replace(replace(replace(name, 'Araya', ''), 'Amul', ''),
'Aj', '')) != length(name)

Actually, this is not quite the same: it's case-sensitive, whereas LIKE is case-insensitive by default. To be equivalent, make it

WHERE length(replace(replace(replace(lower(name), 'araya', ''), 'amul', ''), 'aj', '')) != length(lower(name))

--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to