w3resource
SQL exercises

SQL Exercises: Display the average price of items of each company, showing the name of the company

SQL JOINS: Exercise-23 with Solution

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

Sample table: company_mast

Sample table: item_mast

Sample Solution:

SELECT AVG(pro_price), company_mast.com_name
   FROM item_mast INNER 
     JOIN company_mast
        ON item_mast.pro_com= company_mast.com_id
           GROUP BY company_mast.com_name; 

Output:

SQL Join Exercise

Query Visualization:

Duration:

Query visualization of Display the average price of items of each company, showing the name of the company - Duration

Rows:

Query visualization of Display the average price of items of each company, showing the name of the company - Rows

Cost:

Query visualization of Display the average price of items of each company, showing the name of the company - 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 item name, price, and company name of all the products.
Next: Write a SQL query to display the average price of items of each company, showing the name of the company.

What is the difficulty level of this exercise?



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