I want to select records from sqlite3 database by string matching. But if I use '=' in the where clause, I found that sqlite3 is case sensitive. Can anyone tell me how to use string comparing case-insensitive?
相关问题
- FindFirstFileEx doesn't operate case sensitive
- Case-insensitive primary key of type nvarchar wher
- Case insensitive
- Postgres 12 case-insensitive compare
- NSDictionary case insensitive objectForKey:
相关文章
- Are uppercase utf8 characters always the same numb
- Case insensitive Charfield in django models
- Case insensitive compare against bunch of strings
- MongoDB: how to find documents ignoring case sensi
- Collection removeAll ignoring case?
- Open a file case-insensitively in Ruby under Linux
- Is there a reason to use uppercase letters for hex
- Find possible duplicates in two columns ignoring c
If the column is of type
char
then you need to append the value you are querying with spaces, please refer to this question here . This in addition to usingCOLLATE NOCASE
or one of the other solutions (upper(), etc).This is not specific to sqlite but you can just do
Another option that may or may not make sense in your case, is to actually have a separate column with pre-lowerscored values of your existing column. This can be populated using the SQLite function
LOWER()
, and you can then perform matching on this column instead.Obviously, it adds redundancy and a potential for inconsistency, but if your data is static it might be a suitable option.
Simply, you can use COLLATE NOCASE in your SELECT query:
You can do it like this:
(It's not the solution, but in some cases is very convenient)