210k views
4 votes
Write a SELECT statement that answers this question: Which products have a list price that’s greater than the average list price for all products? Write this using a subquery. Return the ProductName and ListPrice columns for each product. Sort the results by the ListPrice column in descending sequence.

1 Answer

9 votes

Answer:

Following are the query to the given question:

Step-by-step explanation:

Query:

SELECT ProductName,listprice FROM Products where listprice > (SELECT AVG (p.listprice) FROM productsp) ORDER BY listprice DESC;

Description:

In the above-given query, multiple select statements are used, in the first statement, it selects the column that is "ProductName and listprice" from the products table and uses where clause to check the listprice that is greater than another select statement.

In this, it calculates the average listprice of the table and converts a value into descending order.

User Avba
by
5.0k points