mariadb cast null ke 0

SELECT COALESCE(col, 0) FROM `table`;
Matteoweb