MySQL - Removing null value rows from table

If you want to delete all those rows containing username = NULL AND where username is empty string ("") as well

then

DELETE FROM table_name WHERE username IS NULL OR username = '';

It is advised to first do a SELECT query with same WHERE condition as that you are going to use in DELETE query to see which rows will be deleted:

SELECT * FROM table_name WHERE username IS  NULL OR username = "";

Try this

DELETE FROM user WHERE username IS NULL;

or

DELETE FROM user WHERE username = '';

Problems with NULL Values

Tags:

Mysql