If you want to check empty or null value with conditional statement like case when and if in table row with Mysql database. you like to check empty or null value form table then you have multiple way check that. first we check empty value with case when statement then following example.
Empty Check:
SELECT
(CASE WHEN COALESCE(email,'')!='' THEN email ELSE '[email protected]' END) as test
FROM `customers`
---------------------OR----------------------
SELECT
(CASE COALESCE(email,'') WHEN '' THEN '[email protected]' ELSE email END) as test
FROM `customers`
---------------------OR----------------------
SELECT
(IF(COALESCE(email,'')!='',email,'[email protected]')) as exp
FROM `customers`
Null Check:
SELECT
(CASE WHEN email IS NULL THEN '[email protected]' ELSE email END) as test
FROM `customers`
---------------------OR----------------------
SELECT
(IF(email IS NULL,'[email protected]',email)) as exp
FROM `customers`