Posted over 11 years ago. Visible to the public. Repeats.
MySQL: CONCAT with NULL fields
CONCAT('foo', 'bar', NULL) = NULL
the NULL always wins in MySQL.
If you would rather treat NULL as an empty string, use(concatenation with separator) instead:
CONCAT_WS('', 'foo', 'bar', NULL) = 'foobar'
In PostgreSQL the
NULL is not viral in
CONCAT('foo', 'bar', NULL) = 'foobar'