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
Another option is to create your own custom collation. You can then set that collation on the column or add it to your select clauses. It will be used for ordering and comparisons.
This can be used to make 'VOILA' LIKE 'voilà'.
http://www.sqlite.org/capi3ref.html#sqlite3_create_collation
Its working for me Perfectly.
SELECT NAME FROM TABLE_NAME WHERE NAME = 'test Name' COLLATE NOCASE
You can use
COLLATE NOCASE
in yourSELECT
query:Additionaly, in SQLite, you can indicate that a column should be case insensitive when you create the table by specifying
collate nocase
in the column definition (the other options arebinary
(the default) andrtrim
; see here). You can specifycollate nocase
when you create an index as well. For example:Expressions involving
Test.Text_Value
should now be case insensitive. For example:The optimiser can also potentially make use of the index for case-insensitive searching and matching on the column. You can check this using the
explain
SQL command, e.g.:you can use the like query for comparing the respective string with table vales.
select column name from table_name where column name like 'respective comparing value';