implement in Oracle Sql please
5) 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?
Return the product_name and list_price columns for each product.
Sort the results by the list_price column in descending sequence.
Solution:
Query:
SELECT product_name, list_price
FROM products
WHERE list_price > (SELECT AVG (p.list_price)
ORDER BY list_price DESC;
Query with comments for explanation
/* SELECT statement that display productName and List price */
SELECT product_name, list_price
/* from all the products*/
FROM products
/* have a list price that’s greater than the average list price for all products*/
WHERE list_price > (SELECT AVG (p.list_price)
/* Return the product_name and list_price columns for each product */
FROM products p)
/*Sort the results by the list_price column indescending sequence */
ORDER BY list_price DESC;
Get Answers For Free
Most questions answered within 1 hours.