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 Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Calling an Open C library function in... CICS 1
No new posts DATE2 function SYNCSORT 15
No new posts Help on PL/I jsonPutValue function PL/I & Assembler 8
No new posts Timestamp difference and its average ... DB2 11
Search our Forums:

Back to Top