Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use AVG() function in MySQL?

    • 0
    • 1
    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 319
    Comment on it

    What is the use of AVG() function in MySQL?

    The AVG() function is used to return the average of the numeric column in a table.

    AVG() Syntax

    SELECT AVG(column_name) FROM table_name;
    

    We have a table "employee" as below:

        employee
        id  first_name            last_name       salary
        .......................................................
        1   John                     Simp         10000
        2   Chris                    Hely         25000
        3   Joy                      Roy          20000
        4   Jenny                    Mill         35000
    

    AVG() Example

    The below query gives the average value of the "salary" column from the "employee" table:

    SELECT AVG(salary) AS average_salary FROM employee; 
    

    Hope this will help you :)

 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: