Interview Questions   Tutorials   Discussions   Programs   

DB2 - AGGREGATE function support by DB2? A) SUM & AVG B) SUM, MIN & AVG C) SUM, MAX, AVG , MIN &COUNT D) NONE




332
views
asked mar August 20, 2014 10:55 AM  

AGGREGATE function support by DB2? A) SUM & AVG B) SUM, MIN & AVG C) SUM, MAX, AVG , MIN &COUNT D) NONE


           

1 Answers



 
answered By Mswami   0  

Aggregate Functions:


MIN

returns the smallest value in a given column

MAX

returns the largest value in a given column

SUM

returns the sum of the numeric values in a given column

AVG

returns the average value of a given column

COUNT

returns the total number of values in a given column

COUNT(*)

returns the number of rows in a table

Aggregate functions are used to compute against a "returned column of numeric data" from your SELECT statement. They basically summarize the results of a particular column of selected data. We are covering these here since they are required by the next topic, "GROUP BY". Although they are required for the "GROUP BY" clause, these functions can be used without the "GROUP BY" clause.

For example:


SELECT AVG(salary) FROM employee;

This statement will return a single result which contains the average value of everything returned in the salary column from the employee table.

Another example:


SELECT AVG(salary) FROM employee WHERE title = 'Programmer';

This statement will return the average salary for all employees whose title is equal to 'Programmer'

Example:


 SELECT Count(*) FROM employees;

This particular statement is slightly different from the other aggregate functions since there isn't a column supplied to the count function. This statement will return the number of rows in the employees table.

flag   
   add comment

Your answer

Join with account you already have

FF

Preview

 Write A Tutorials
Online-Classroom Classes
www.writeabc.com


  1 person following this question

  1 person following this tag

  Question tags

Asked 2 years and 3 months ago ago
Number of Views -332
Number of Answers -1
Last updated
3 years and 3 months ago ago

  Similar questions

Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert