I am using SQL. I don\'t know how to do subqueries yet. Please use the simplest
ID: 3811129 • Letter: I
Question
I am using SQL. I don't know how to do subqueries yet. Please use the simplest subquery with explanation. Thank you so much.
(Use the "my guitar shop" database to answer this question.) 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?" (Your query should include a way to calculate that average each time the query is run, so that if the data in the database changes, it will still generate an accurate result set at the time of running the query. A good way of doing that is using a subquery.) Return the product name and list price columns for each product. Sort the results by the list price column in descending sequence. This is the result set you should get: Result Grid l ETE Filter Rows product name list price 2517.00 Gibson SG Gibson Les Paul 1199.00 (2 rowsExplanation / Answer
The above query retrieves the product name and price in the descending order which are greater than average cost of all products.
Here in this the first part is we are selecting the product name and list price columns and comparing the list price with the average price of all products. For this average price we have written subquery in the () by this sub query it gives the average price of all products and then it is compared with the list price which ever satisfies the condition those values will return as output.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.