I have created the above table on SQL workbench and trying to run a very basic query of giving the data in desc order according to salary (code shown below along with output) however I am not getting the correct output. Can anyone please help me with this
Advertisement
Answer
salary
is obviously a text field. Either change it to an numeric type (integer or decimal would be appropriate), or CAST
it in the query:
SELECT * FROM employee ORDER BY CAST(salary AS UNSIGNED) DESC