title: How can I use Coalesce and Max to extract maximum valued column which is not null
body: <p>I have columns <code>A, B, C and D</code> and would like to create new calculated column with <code>MAX(COLUMN_A, COLUMN_B)/MAX(COLUMN_C, COLUMN_D)</code>.</p>
  
  <p>Some of the rows in these columns also have NULL values, How Can I do this in Impala or SQL</p>
  
  <p><a href="https://i.stack.imgur.com/WhF4U.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WhF4U.png" alt="enter image description here"></a></p>