division by zero postgres

Solutions on MaxInterview for division by zero postgres by the best coders in the world

showing results for - "division by zero postgres"
Ousmane
11 May 2016
1SELECT 1.0 / NULLIF(column_that_may_be_zero, 0)
Nicolò
06 Mar 2017
1-- avoid division error in Postgres
2value/NULLIF(col, 0)  -- if col == 0, NULL will be returned
3value/COALESCE(NULLIF(col, 0), 1)  -- if col == 0, value will be returned