Can any one please let me know the best way to use IF statement in mysql query to show if the "email" field is NULL then it should show as "no email"...
Postcode Telephone Email
----------------------------------------------------------
BS20 0QN 1275373088 no email
BS20 0QN 1275373088 no email
PO9 4HG 023 92474208 [email protected]
SO43 7DS 07801 715200 [email protected]
----------------------------------------------------------
The MySQL ISNULL() function is used for checking whether an expression is NULL or not. This function returns 1 if the expression passed is NULL, else it returns 0.
The IS NULL operator is used to test for empty values (NULL values).
Checking for missing values using isnull() In order to check null values in Pandas DataFrame, we use isnull() function this function return dataframe of Boolean values which are True for NaN values.
Use the COALESCE function:
COALESCE(Email, 'no email')
Try this way
SELECT *
FROM table
WHERE YourColumn IS NULL;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With