How to change the collation of sqlite3 database to sort case insensitively?

rkb picture rkb · Jul 27, 2009 · Viewed 27k times · Source

I have a query for sqlite3 database which provides the sorted data. The data are sorted on the basis of a column which is a varchar column "Name". Now when I do the query

select * from tableNames Order by Name;

It provides the data like this.

    Pen
    Stapler
    pencil

Means it is considering the case sensitive stuff. The way I want is as follows

    Pen
    pencil
    Stapler

So what changes should I make in sqlite3 database for the necessary results?

Related How to set Sqlite3 to be case insensitive when string comparing?

Answer

Haris Custo picture Haris Custo · Aug 4, 2010

To sort it Case insensitive you can use ORDER BY Name COLLATE NOCASE