My sql query :
select * from users where email = email and password=password;
Result :
Expected Result :
I want to replace all null values with the empty string(" ").
My sql query :
select * from users where email = email and password=password;
Result :
Expected Result :
I want to replace all null values with the empty string(" ").
Example:
Using IFNULL:
SELECT
IFNULL(firstName,'') AS firstName,
IFNULL(lastName,'') AS lastName,
....
FROM YOUR_TABLE.
Using COALESCE:
SELECT
COALESCE(firstName,'') AS firstName,
COALESCE(lastName,'') AS lastName,
....
FROM YOUR_TABLE
Note:
The main difference between the two is that IFNULL function takes two arguments and returns the first one if it's not NULL or the second if the first one is NULL.
COALESCE function can take two or more parameters and returns the first non-NULL parameter, or NULL if all parameters are null
Null values with empty string in your table and later altering the columns to NOT NULLNULL value during insertion then I think you can approach this way I mean using COALESCE/IFNULL