SQL Exercises: Display the average price of each company's products, along with their code
SQL Aggregate Functions: Exercise-23 with Solution
Write a SQL query to display the average price of each company's products, along with their code.
Sample table: item_mast
SELECT AVG(pro_price) AS "Average Price", pro_com AS "Company ID" FROM item_mast GROUP BY pro_com;
Output of the Query:
Average Price Company ID 250.0000000000000000 14 650.0000000000000000 12 3200.0000000000000000 15 5000.0000000000000000 11 1475.0000000000000000 13 500.0000000000000000 16
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework