What is this Site!!

All about Real time requirements in Orale Stay Tune!!
Showing posts with label Practice AGGREGATE FUNCTIONS. Show all posts
Showing posts with label Practice AGGREGATE FUNCTIONS. Show all posts

Tuesday, January 22, 2008

What are AGGREGATE FUNCTIONS?



>>>Previous>>>



FUNCTIONS : These functions operate over a set of values.They are also known as aggregate functions


MAX(): A function used find maximum value among the given values.

SQL > SELECT MAX(SAL) FROM EMP;

MAX(SAL)
---------
5000

MIN(): It returns minimun of the values in a column.

SQL > SELECT MIN(HIREDATE) FROM EMP;

MIN(HIRED
---------
17-DEC-80


AVG(): Gives the average of values in a column.

SQL >SELECT AVG(SAL) FROM EMP;

AVG(SAL)
----------
2073.21429



SUM(): Sum of the values in a column


SQL >SELECT SUM(SAL) FROM EMP;

SUM(SAL)
----------
29025



COUNT(*): Gives number of columns in a table.


SQL >SELECT COUNT(*) FROM DUAL;

COUNT(*)
----------
1

SQL >SELECT COUNT(*) FROM EMP;

COUNT(*)
----------
14



COUNT(): Gives no of not null ENTRIE (VALUES) in that column.


SQL >SELECT COUNT(COMM) FROM EMP;

COUNT(COMM)
-----------
4


SQL >SELECT COUNT(DISTINCT JOB) FROM EMP;

COUNT(DISTINCTJOB)
------------------
5


Explanation: Using DISTICT, duplicate values can be suppressed.




>>>Next>>>