mariadb cast null ke 0
SELECT COALESCE(col, 0) FROM `table`;
Matteoweb
SELECT COALESCE(col, 0) FROM `table`;