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

Aggregate functions in case of Columns having Nulls


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

New User


Joined: 29 May 2005
Posts: 12

PostPosted: Wed Jul 20, 2005 2:33 pm
Reply with quote

Hi All,
Suppose I have a DB2 Table having one of column as Amount.This column has been declared to have Null Values allowed in it.

FOllowing are my Queries : -

1) Wat value will be returned when I say MAX (Amount ) assuming there are 5 rows in the table having values as

100
200
Null
300
400

in the Amount field ? Will it Abend or value 400 be returned ?
Similarly will SUM return value 1000 or Abend ?
Back to top
View user's profile Send private message
rssomm

New User


Joined: 05 Jun 2005
Posts: 41
Location: Hyderabad

PostPosted: Wed Jul 20, 2005 3:26 pm
Reply with quote

Max Value would be 400 and sum is 1000. There will be no ABEND.


Madhu
Back to top
View user's profile Send private message
narasimha_devi
Warnings : 1

New User


Joined: 10 Mar 2005
Posts: 26

PostPosted: Mon Jul 25, 2005 2:05 pm
Reply with quote

very fine answer.but what abt the averagre value.does null is cosidered r not.plesae clarify


thaks in advance
Back to top
View user's profile Send private message
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

PostPosted: Mon Jul 25, 2005 2:14 pm
Reply with quote

Hi,

The AVG function is applied to the set of values derived from the argument values by the elimination of null values. So only the not null values are counted.

Thanks,
Reddy.
Back to top
View user's profile Send private message
narasimha_devi
Warnings : 1

New User


Joined: 10 Mar 2005
Posts: 26

PostPosted: Tue Jul 26, 2005 6:27 pm
Reply with quote

thank u very much.i got answers for allquestions and its surprise that theperson is same inboth thecases.

thank u very much onceagain
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 COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Increase the number of columns in the... IBM Tools 3
No new posts DB2 Views with Multiple SQL & Col... DB2 8
No new posts Zunit Test case editor error Testing & Performance 4
Search our Forums:

Back to Top