Mysql – Check is there is an Empty Column Value

MySQL

Let's say we have a Table in MySQL Database called TAB1 that Contains two Columns col1 : col2 .
the question is :
is there a way to check is any of these Columns Contain a Null or Empty Value?
for the Condition WHERE col_Name is null OR col_Name='' , this Query checks one Column, I want to check all the Columns using a simple Query.

Best Answer

You can use ISNULL and NULLIF for this purpose:

SELECT * FROM `TAB1` WHERE ISNULL(col1, '') = '' OR ISNULL(col2, '') = ''

or

SELECT * FROM `TAB1` WHERE NULLIF(col1, '') IS NULL OR NULLIF(col2, '') IS NULL