I have a few records which start with lowercase & uppercase.
SELECT * FROM wording ORDER BY word ASC;
Lanza
Mensi
Mhiob
blackbery
umbre
apple
Etios
Iomio
I am trying to order this by A-Z and a-z, something like
Etios
Iomio
Lanza
Mensi
Mhiob
apple
blackberry
umbre
So, all the word which is starting with capital come first and after then all lowercase words.
CodePudding user response:
I think ASCII function might help you -
SELECT * FROM wording
ORDER BY CASE WHEN ASCII(word) BETWEEN 65 AND 90 THEN 1 ELSE 2 END ASC, word DESC;
CodePudding user response:
This should work too:
select *
from wording
order by binary(word) ASC;
Result:
word Etios Iomio Lanza Mensi Mhiob apple blackbery umbre
Reference Website:SQL Practice