How do I delete blank rows in Mysql?

Jose H d picture Jose H d · Jan 8, 2011 · Viewed 59.6k times · Source

I do have a table with more than 100000 data elements, but there are almost 350 blank rows within. How do I delete this blank rows using phpmyadmin? Manually deleting is a tedious task.

Answer

Spiny Norman picture Spiny Norman · Jan 8, 2011

The general answer is:

DELETE FROM table_name WHERE some_column = '';

or

DELETE FROM table_name WHERE some_column IS NULL;

See: http://dev.mysql.com/doc/refman/5.0/en/delete.html

More info when you post your tables!~

Also, be sure to do:

SELECT * FROM table_name WHERE some_column = '';

before you delete, so you can see which rows you are deleting! I think in phpMyAdmin you can even just do the select and then "select all" and delete, but I'm not sure. This would be pretty fast, and very safe.