w3resource
SQL exercises

SQL Subquery Exercises: Display the average price of the products which is more than or equal to 350 along with theri names

SQL SUBQUERY: Exercise-32 with Solution

32. Write a SQL query to display the average price of the products which is more than or equal to 350 along with theri names.

Sample table: company_mast


Sample table: item_mast


Sample Solution:

SELECT AVG(pro_price) AS "Average Price", 
   company_mast.com_name AS "Company"
      FROM item_mast, company_mast
         WHERE item_mast.pro_com= company_mast.com_id
           GROUP BY company_mast.com_name
   HAVING AVG(pro_price) >= 350;

Output :

SQL Subqueries Exercise

Practice Online


Sample Database:

Model Database

Query Visualization:

Duration:

Query visualization of Display the average price of the products which is more than or equal to 350 along with theri names - Duration

Rows:

Query visualization of Display the average price of the products which is more than or equal to 350 along with theri names - Rows

Cost:

Query visualization of Display the average price of the products which is more than or equal to 350 along with theri names - Cost

Contribute your code and comments through Disqus.

Previous: Write a SQL query to find the average price of each manufacturer's products along with their name.
Next: Write a SQL query to display the name of each company, price for their most expensive product along with their ID.

What is the difficulty level of this exercise?



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