Select * from emp order by code
[ here ‘code’ is a text field], result in unordered result due to the data type, in MS SQL and My SQL too.
To override this issue we can simply cast the field code using the cast operator.
select * from emp order by cast (code as int) Asc