> When I use ORDER BY an ? comes after a z. Is it possible to make an ? come > after a z? > If it is important I am using SQLite 3.8.6 and Python 3.4.1.
If you're using the Python built-in sqlite3 module, you're looking for create_collation https://docs.python.org/2/library/sqlite3.html#sqlite3.Connection.create_collation Something like this (adapted from that example in the docs): import sqlite3 def collate(string1, string2): return cmp(string1, string2) con = sqlite3.connect(":memory:") con.create_collation("mycollation", collate) cur = con.cursor() cur.execute("create table test(x)") values = [u'z', u'?'] values = map(lambda x: (x,), values) cur.executemany("insert into test(x) values (?)", values) cur.execute("select x from test order by x collate mycollation") for row in cur: print row con.close() That still won't sort right, but now you have the collate() function as a place to plug in your actual collation logic. For that, you want something like Locale (https://docs.python.org/2/library/locale.html) or ICU (https://pypi.python.org/pypi/PyICU/) -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Message signed with OpenPGP using GPGMail URL: <http://mailinglists.sqlite.org/cgi-bin/mailman/private/sqlite-users/attachments/20151010/6e997977/attachment.pgp>