Postgres: Erreur: Division par zéro
SELECT 1.0 / NULLIF(column_that_may_be_zero, 0)
Obedient Osprey
SELECT 1.0 / NULLIF(column_that_may_be_zero, 0)
-- avoid division error in Postgres
value/NULLIF(col, 0) -- if col == 0, NULL will be returned
value/COALESCE(NULLIF(col, 0), 1) -- if col == 0, value will be returned