alt
Advertisement

Online Training
Career Series
Exforsys
Exforsys arrow Tutorials arrow Oracle 9i arrow Tutorial 4: SQL functions
Site Search
Sponsored Links



Tutorial 4: SQL functions
Article Index
Tutorial 4: SQL functions
Page 2
Page 3
Page 4
Page 5
Page 6
Page 7

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(<columnname>): 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.



 
< Prev   Next >
Sponsored Links
© 2008 Exforsys.com
Joomla! is Free Software released under the GNU/GPL License.
Page copy protected against web site content infringement by Copyscape