Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite query, 'LIKE'

I am trying to retrieve information from my database.
I have words like Lim Won Mong and Limited.

If I do my query, SELECT name FROM memberdb WHERE name LIKE '%LIM%', it displays both Lim Won Mong and Limited and I only want data from Lim Won Mong.

How should I rewrite my query?

like image 663
Lene Avatar asked Sep 27 '12 04:09

Lene


People also ask

Can you use like in SQLite?

Introduction to SQLite LIKE operator Note that you can also use the LIKE operator in the WHERE clause of other statements such as the DELETE and UPDATE . The percent sign % wildcard matches any sequence of zero or more characters. The underscore _ wildcard matches any single character.

What is like in SQLite?

SQLite LIKE operator checks whether a specific character string matches a specified pattern. The operand to the right of the LIKE operator contains the pattern and the left-hand operand contains the string to match against the pattern.

Does SQLite support parameterized query?

In SQLite, parameters are typically allowed anywhere a literal is allowed in SQL statements. Parameters can be prefixed with either : , @ , or $ . command.


1 Answers

Execute following Query:

select name from memberdb where name like '% LIM %' OR name like "LIM %" OR name like "% LIM" OR name like "LIM"
like image 187
jeet Avatar answered Oct 20 '22 10:10

jeet