Using SQL AVG with arithmetic operators (+, -, *, /)

In SQL, the AVG function is used to calculate the average value of a specified column or expression. This can be useful in situations where you need to find the average of numeric values stored in a table.

However, you can also combine the AVG function with arithmetic operators to perform calculations on the average value. This allows you to further manipulate the data and obtain meaningful results.

Adding Values to the Average

To add values to the average, you can use the + operator. This is useful when you want to find the total sum of a column and then divide it by the number of rows to calculate the average including the additional values.

Here’s an example that demonstrates how to use the + operator with the AVG function:

SELECT AVG(column_name + additional_value) AS average_with_addition
FROM table_name;

Replace column_name with the name of the column you want to average, and additional_value with the value you want to add to the average.

Subtracting Values from the Average

To subtract values from the average, you can use the - operator. This allows you to exclude specific values from the calculation of the average.

Here’s an example that shows how to use the - operator with the AVG function:

SELECT AVG(column_name - excluded_value) AS average_with_subtraction
FROM table_name;

Replace column_name with the name of the column you want to average, and excluded_value with the value you want to subtract from the average.

Multiplying Values with the Average

If you want to multiply values with the average, you can use the * operator. This can be useful when you want to find the combined effect of multiplying the average value with another column or a constant.

Here’s an example that demonstrates how to use the * operator with the AVG function:

SELECT AVG(column_name) * multiplier AS multiplied_average
FROM table_name;

Replace column_name with the name of the column you want to average, and multiplier with the value you want to multiply with the average.

Dividing Values by the Average

To divide values by the average, you can use the / operator. This can be helpful when you need to scale or normalize other values in relation to the average.

Here’s an example that shows how to use the / operator with the AVG function:

SELECT column_name / AVG(column_name) AS scaled_values
FROM table_name;

Replace column_name with the name of the column you want to scale or normalize.


By using the arithmetic operators with the AVG function in SQL, you can perform calculations on the average value and obtain more meaningful insights from your data.