w3resource
SQL exercises

SQL Exercises: Display the names of the company whose products have an average price larger than or equal to Rs.350

SQL JOINS: Exercise-24 with Solution

Write a SQL query to display the names of the company whose products have an average price larger than or equal to Rs.350.

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
   HAVING AVG(pro_price) >= 350;

Output:

SQL Join Exercise

Query Visualization:

Duration:

Query visualization of Display the names of the company whose products have an average price larger than or equal to Rs.350 - Duration

Rows:

Query visualization of Display the names of the company whose products have an average price larger than or equal to Rs.350 - Rows

Cost:

Query visualization of Display the names of the company whose products have an average price larger than or equal to Rs.350 - 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 average price of items of each company, showing the name of the company.
Next: Write a SQL query to display the name of each company along with the ID and price for their most expensive product.

What is the difficulty level of this exercise?



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