SQL Subquery Exercises: Display the name of each company, price for their most expensive product along with their Name
SQL SUBQUERY: Exercise-33 with Solution
33. Write a SQL query to display the name of each company, price for their most expensive product along with their Name.
Sample table: company_mast
Sample table: item_mast
SELECT P.pro_name AS "Product Name", P.pro_price AS "Price", C.com_name AS "Company" FROM item_mast P, company_mast C WHERE P.pro_com = C.com_id AND P.pro_price = ( SELECT MAX(P.pro_price) FROM item_mast P WHERE P.pro_com = C.com_id );
Contribute your code and comments through Disqus.
Previous: Write a SQL query to display the average price of the products which is more than or equal to 350 along with theri names.
Next: Write a query in SQL to find all the details of employees whose last name is Gabriel or Dosio.
What is the difficulty level of this exercise?