如何使用SQL Order By语句对结果进行sorting不区分大小写?

我有一个SQLite数据库,我想按字母顺序sorting。 问题是,在sorting过程中,SQLite似乎不考虑A = a,因此我得到如下结果:

A B C T a b c g

我想得到:

A a b B C c g T

需要做什么特殊的SQL事情,我不知道?

SELECT * FROM NOTES ORDER BY title 

你也可以做ORDER BY TITLE COLLATE NOCASE

编辑:如果你需要指定ASCDESC ,像NOCASE之后添加这个

ORDER BY TITLE COLLATE NOCASE ASC

要么

ORDER BY TITLE COLLATE NOCASE DESC

您可以将所有内容转换为小写字母以便进行sorting:

 SELECT * FROM NOTES ORDER BY LOWER(title); 

如果你想确保大写字母仍然以小写字母开头,那就把它作为第二种:

 SELECT * FROM NOTES ORDER BY LOWER(title), title; 
 SELECT * FROM NOTES ORDER BY UPPER(title)