AVG() Function


 

SQLite: AVG Function

This SQLite tutorial explains how to use the SQLite AVG Function with syntax and examples.

 

Description:
The SQLite AVG function returns the average value of an expression.

 
Syntax:

 

Parameters or Arguments:

expression1, expression2, … expression_n

The expressions that are not encapsulated within the AVG function and must be included in the GROUP BY clause at the end of the SQL statement.

aggregate_expression

This is the column or expression that will be averaged.

tables

The tables that you wish to retrieve records from. There must be at least one table listed in the FROM clause.

conditions

These are conditions that must be met for the records to be selected.

 

Examples:

  • The following SQLite statement returns the average value of the “salary” columns from the “Account” table:

    SalaryAverage
    30000

     

  • The following SQLite statement returns all the “salary” that are above average salary:

    id salary account_no emp_id
    2 60000 1001 101
    3 40000 1002 102
    4 35000 1003 103
    5 35000 1004 104