mysql case when null 1

mysql case when null

SELECT IF(guides.colName IS NULL, 'Yes','No') FROM tableName;

-- Or
SELECT
	CASE 
      WHEN colName IS NULL THEN 'Yes'
      ELSE 'No'
	END
FROM tableName;

Here is what the above code is Doing:
1. We’re selecting the colName column from the guides table.
2. We’re using the IF function to check if the colName column is NULL.
3. If the colName column is NULL, we want to return the string ‘Yes’.
4. If the colName column is not NULL, we want to return the string ‘No’.

Similar Posts