I need help with an SQL query with the following questions What\'s the average u
ID: 3585172 • Letter: I
Question
I need help with an SQL query with the following questions
What's the average unit price of products?
What's the average unit price for and count of products that are out of stock? (stock = 0, not counting things ordered.)
The table is attached:
Limt to 1000 rows- 1SELECT FROM Products Result Grid Wrap Cell Content ProductID ProductName SuppierID CategoryID QuanttyPerUnit UnitPrice UnitsInStock UnitsOnOrder Rcorderlevel Discontinued Chef Anton's Caiun Seasonina 2 Chef Anton's Gumbo Mx Grandma's Bovsenberry Soreed 3 Unde Bob's Oraanic Dried Pears 3 Northwoods Cranberrv Sauce 3 Oueso Mancheco La Pastora 5 Teatime Chocolate EisouitsExplanation / Answer
1.
Select AVG(UnitPrice) from Products;
AVG aggregate function is used here.
2.
Select AVG(UnitPrice),COUNT(ProductID) from Products where UnitsInStock = 0;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.