w3resource
SQL exercises

SQL Exercises: Find the average purchase amount of all orders

SQL Aggregate Functions: Exercise-2 with Solution

Write a SQL statement to find the average purchase amount of all orders.

Sample table: orders


Sample Solution:

SELECT AVG (purch_amt) 
FROM orders;

Output of the Query:

avg
1461.7650000000000000

Explanation:

Syntax of find the average purchase amount of all orders

Pictorial presentation :

Find the average purchase amount of all orders

Query Visualization:

Duration:

Query visualization of Find the average purchase amount of all orders - Duration

Rows:

Query visualization of Find the average purchase amount of all orders - Rows

Cost:

Query visualization of Find the average purchase amount of all orders - Cost

 

Practice Online


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

Previous: Write a SQL statement to find the total purchase amount for all orders.
Next: Write a SQL statement to find the number of salesmen currently listing for all of their customers.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming