w3resource
SQL exercises

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


Sample Solution:

SELECT AVG(pro_price) AS "Average Price", 
       pro_com AS "Company ID"
    FROM item_mast
GROUP BY pro_com;

Sample table: item_mast


Output:

SQL Join Exercise

Query Visualization:

Duration:

Query visualization of Display the average price of each company's products, along with their code - Duration

Rows:

Query visualization of Display the average price of each company's products, along with their code - Rows

Cost:

Query visualization of Display the average price of each company's products, along with their code - Cost

Practice Online


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

Previous: Write a SQL query to find the number of products with a price more than or equal to Rs.350.
Next: Write a query in SQL to find the sum of the allotment amount of all departments.

What is the difficulty level of this exercise?



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