w3resource

SQL Exercises: Calculate the average price of all the products

SQL Aggregate Functions: Exercise-21 with Solution

Write a SQL query to calculate the average price of all the products.

Sample table: item_mast


Sample Solution:

SELECT AVG(pro_price) AS "Average Price" 
   FROM item_mast;

Output of the Query:

Average Price
1435.0000000000000000

Practice Online


Query Visualization:

Duration:

Query visualization of Calculate the average price of all the products - Duration

Rows:

Query visualization of Calculate the average price of all the products - Rows

Cost:

Query visualization of Calculate the average price of all the products - Cost

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a query that counts the number of salesmen with their order date and ID registering orders for each day.
Next: Write a SQL query to find the number of products with a price more than or equal to Rs.350.

What is the difficulty level of this exercise?