You can create your own custom collation function by calling the sqlite3_create_collation() family of functions right after connecting to the database file. Your function can the do whatever it likes to process its arguments, as long as it implements a reflexive, transitive, antisymmetric, and total order. see https://sqlite.org/c3ref/create_collation.html for details