IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

problem is average function


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
meetsrk

New User


Joined: 13 Jun 2004
Posts: 85

PostPosted: Tue Jul 06, 2004 9:50 pm
Reply with quote

hi ppl,

when we are using average function in a query for a table where some of the salary are null then wat will be the output of the following query,

Code:

select avg(salary) from emp


say emp has 10 records out of which 3 records are having NULL value.

so will it calculate the sum of the all the salaries irrespective of NULL(taking nulls as zero) and divides by 10.

or

will it calculate the sum of all the salaries which does not have NULL and divide it by 7
Back to top
View user's profile Send private message
imvs

New User


Joined: 12 May 2004
Posts: 33

PostPosted: Tue Jul 06, 2004 11:28 pm
Reply with quote

check the second question of this post
http://ibmmainframes.com/expertforum/viewtopic.php?t=785
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts z/vm installation problem All Other Mainframe Topics 0
No new posts Job scheduling problem. JCL & VSAM 9
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Need to add field to copybook, proble... COBOL Programming 14
No new posts z/vm ipl problem All Other Mainframe Topics 5
Search our Forums:

Back to Top