w3resource
SQL exercises

SQL: Display the average price of the items for each company, showing only the company code

SQL Basic Select Statement : Exercise-29 with Solution.

Write a SQL query to display the average price of the items for each company, showing only the company code.

Sample table : item_mast

 

Sample Solution:

SELECT AVG(pro_price), pro_com
    FROM item_mast
GROUP BY pro_com;

Output:

SQL exercises

Query Visualization:

Duration:

Query visualization of Display the average price of the items for each company, showing only the company code - Duration

Rows:

Query visualization of Display the average price of the items for each company, showing only the company code - Rows

Cost:

Query visualization of Display the average price of the items for each company, showing only the company code - Cost

Practice Online


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

Previous: Write a SQL query to display the name and price of all the items with a price is equal or more than Rs.250, and the list contain the larger price first and then by name in ascending order.
Next: Write a SQL query to find the name and price of the cheapest item.

What is the difficulty level of this exercise?



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