I want to find the average of 3 columns using hive query.
Consider the below data:
I need to find the average marks scored by each student and then the average of total marks in each school: NULL should be ignored.
My output should look like this:
Can you guys help me out here
Hive should automatically ignore NULL
values on aggregates as reported here.
For readability, I suggest using COALESCE
instead of IF IS NULL
statements such as: COALESCE(Math,0) as Math