2

In Athena, what is the most efficient way to fill null values with 0?

I think I can use Case statement, but I am also curious if there are other ways to do it.

halfer
  • 19,824
  • 17
  • 99
  • 186
Yun Tae Hwang
  • 1,249
  • 3
  • 18
  • 30
  • There is [existing](https://stackoverflow.com/a/43275417/14843902) thread related to this. – amitd Jan 29 '21 at 13:26

1 Answers1

8

We can use coalesce, here is Presto documentation on conditions which is what Athena is built on.

select coalesce(myColumn, 0) from my_table_name
halfer
  • 19,824
  • 17
  • 99
  • 186
Balu Vyamajala
  • 9,287
  • 1
  • 20
  • 42