select AVG( TEMP ) from QGPL/WEATHER1

…should give you the average (the ‘mean’).

But quartiles should be more related to “median” than “mean”. The “median” of a frequency distribution is the 2nd quartile. The median is just the point where there are as many above as below.

The median can be determined essentially just by counting the ordered data.

Once you have the median, you have the lower half and the upper half of the ordered values. The 1st quartile is just the ‘median’ of the lower half. And the 3rd quartile is then the ‘median’ of the upper half.

In general, the overall count is just:

select COUNT(*) from QGPL/WEATHER1

The median row would be row number COUNT(*)/2 of the ordered set. And the 1st quartile would be row number COUNT(*)/4. (Rounding might be useful for both.)

What version of DB2 are you running. (The version of the OS will be the same for IBM i.)

Tom

]]>