I have a table like this. table(student_name nvarchar(20) not NULL, grades int). When I write
select * from table
order by grades asc
It shows this
student_name | grades
---------------------
Ann | NULL
Bob | NULL
Bob | 10
Jane | 25
Nelly | 30
when select * from table
order by grades desc
student_name | grades
---------------------
Nelly | 30
Jane | 25
Bob | 10
Ann | NULL
Bob | NULL
But I need to order by like this. NULLs in the end but those who have grades order by ascending order, like
student_name | grades
---------------------
Bob | 10
Jane | 25
Nelly | 30
Ann | NULL
Bob | NULL
How it is possible to do a conditional order by like this? How to specify NULL values to be at the end?