Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use Sql Avg () Function ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 637
    Comment on it

    Hi Reader's,
      Welcome to FindNerd, today we are going to discuss how to use  Sql Avg () Function in Sql  ?

    So, basically this function is used for returning the average of numeric column.If in a table there is null value then this function ignored that value.

    Syntax of Sql Avg () function :

    select avg (column_name) from table_name where clause;

    //Here clause is optional

    You can see below example :

    Table name : Empl_Info

     Empl_Id         Empl_name          Empl_Age          Empl _Salary
         1                  Deepak                    23                     120000
         2                  Manoj                       24                     250000
         3                  Uday                        20                     420000
         4                  Pradeep                   35                     750000
         5                  Shiva                       26                     820000
         6                  Ravi                         25                     350000

    Now we want find the AVG salary of employee list.  

    Then we will use below query

    select avg (Empl _Salary) from Empl_Info ;

    Output will come following:

    Average of Empl _Salary is :
        451666.666666667

     

     

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: