Guest User

Untitled

a guest
Jan 16th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. name, age,gender
  2. "John", 33,m
  3. "Sam", 33,m
  4. "Julie",33,f
  5. "Jimbo",, m
  6.  
  7. SELECT AVG(age) FROM [peterprivatedata.testpeople]
  8.  
  9. SELECT sum(if(is_explicitly_defined(numeric_field), numeric_field, 0)) /
  10. sum(if(is_explicitly_defined(numeric_field), 1, 0))
  11. AS my_avg FROM your_table
  12.  
  13. SELECT sum(if(numeric_field_is_null, 0, numeric_field)) /
  14. sum(if(numeric_field_is_null, 0, 1))
  15. AS my_avg FROM your_table
Add Comment
Please, Sign In to add comment