Order BY Customized - Char by Char My target is to sort text columns by a custom sorting.
e.g., ADBC instead of the usual ABCD.

With this custom ordering, rows would be ordered by in this way:

ADAGIO
ABACUS
DICE
BEE


Because D comes before B.

If I'd need to sort texts of one letter that would be easy:

SELECT * FROM my_db
ORDER BY case when text_plain = 'A' then 1
              when text_plain = 'D' then 2
              when text_plain = 'B' then 3
              when text_plain = 'C' then 4
              else 5
         end asc


But text contains multiple characters.
Is this feasible?

I am using Sqlite in this case.
SQLite's C API has functions to create custom collations.

SQLiteStudio allows you to create such collations in any of its supported scripting languages.