SQLite Choose where a column contains a row from?

I currently have a column-based fetch with the same value.

"SELECT * FROM users WHERE uuid = ?" 

But what if I want to return a row based on one of the columns containing the "string value"? Some pseudo-code would be:

 SELECT * FROM users WHERE column CONTAINS mystring 

Any help is appreciated, I was looking for other answers, but to no avail.

+11
sqlite
source share
3 answers

SELECT * FROM users WHERE column LIKE '%mystring%' will do this.

LIKE means that we do not perform an exact match ( column = value ), but do an even more fuzzy match. "%" is a wildcard - it matches 0 or more characters, so it says "all rows in which a column has 0 or more characters, and then" mystring "followed by 0 or more characters".

+30
source share

Use the LIKE . For example. if your string contains "pineapple123" , your query will look like this:

 SELECT * from users WHERE column LIKE 'pineapple%'; 

And if your line always starts with any number and ends with any number, for example "345pineapple4565" , you can use:

 SELECT * from users WHERE column LIKE "%pineapple%"; 
+5
source share

It’s just that using instr you don’t need to specify an extra character.

 Select * from repos where instr("column_name", "Search_string") > 1 
0
source share

All Articles