name2 could be string or number. I.e. 'one two' or 12
I would like to order names so that numbers to be last, i.e:
a a
b b
one two
1
22
select name1, name2
from names
order by name2
Q: how one would do it?
P.S. in oracle it is like this.
You can use REGEXP_REPLACE() function with '[^[:digit:]]*' posix, to determine whether the string has a digit or not in it, including an asterisk at the end to anchor a regular expression to the end of the source text :
SELECT name2
FROM t
ORDER BY REGEXP_REPLACE(name2,'[^[:digit:]]*',''), name2
You can use a boolean expression in order by, e.g.:
select name1, name2
from names
order by left(name2, 1) <= '9', name2