MySQL: Order by field, placing empty cells at end

Solution 1:

select * from table
order by if(field = '' or field is null,1,0),field

Solution 2:

This is one of the most effective method

ASC Order

SELECT * FROM user ORDER BY name IS NULL, name ASC

Expected Result:

+----+--------+------------+
| id |  name  | date_login |
+----+--------+------------+
|  3 |  david | 2016-12-24 |
|  2 |  john  | NULL       |
|  4 |  zayne | 2017-03-02 |
|  1 |  NULL  | 2017-03-12 |

DESC Order

SELECT * FROM user ORDER BY name IS NULL, name DESC

Expected Result:

+----+--------+------------+
| id |  name  | date_login |
+----+--------+------------+
|  4 |  zayne | 2017-03-02 |
|  2 |  john  | NULL       |
|  3 |  david | 2016-12-24 |
|  1 |  NULL  | 2017-03-12 |