Last updated on May 13th, 2016 at 12:16 pm

Mysql search rows where column is null

This is a simple query in Mysql which will return the null fields in a column from the table. This will be useful to search for null fields.

Select statement will look like this.

SELECT * from TABLE_NAME where COLUMN_NAME is null or COLUMN_NAME='';

This statement.[Here i am setting a value ‘no’ to my columns that are blank]

UPDATE TABLE_NAME SET COLUMN_NAME = 'no' WHERE COLUMN_NAME is null or COLUMN_NAME=''

Leave a Reply

Your email address will not be published. Required fields are marked *