Is there any way to do an accent-insensitive LIKE query in SQLite? For example, this query:
SELECT * FROM users WHERE name LIKE "Andre%"
would return:
André the Giant Andre Agassi etc.
I'm using Qt with QSqlDatabase if it makes any difference.
To be case insensitive on firstname , write this: select * from tbl where firstname='john' COLLATE NOCASE and lastname='doe' . It's specific to that one column, not the entire where clause.
Case Sensitivity The important point to be noted is that SQLite is case insensitive, i.e. the clauses GLOB and glob have the same meaning in SQLite statements.
Collating sequences are used by SQLite when comparing TEXT values to determine order and equality. You can specify which collation to use when creating columns or per-operation in SQL queries. SQLite includes three collating sequences by default.
Set up a collation using sqlite3_create_collation
and then use it like this:
SELECT * FROM users WHERE name LIKE "Andre%" COLLATE NOACCENTS
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With