Answers for "coalesce command in mysql"

SQL
3

mysql coalesce

#Avoid sum null
SELECT SUM(COALESCE(field_with_null_values, 0)) as s FROM tablename

#Avoid concat string null
SELECT CONCAT(name_never_null, ' ', COALESCE(surname_with_null_values, '')) as complete_name FROM users
Posted by: Guest on March-30-2021
-2

coalesce mysql

The COALESCE() function returns the first non-null value in a list.

Example : SELECT COALESCE(NULL, NULL, 'W3Schools.com', NULL, 'Example.com');

output : 'W3Schools.com'
Posted by: Guest on November-19-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language