Menu

[Solved]Create Function Determines Nth Profitable Store Receive Value N Parameter Query Done Order Q37279690

Create a function that determines the nth mostprofitable store. Receive the value n as a parameter

This is the query I have done to order the Store based onprofit, which is the total sum of items sold times the quantity ofthe inventory.

SELECT name, (SUM(price * quantity)) AS TotalPrice FROM Items NATURAL JOIN Inventory GROUP BY name ORDER BY (TotalPrice) DESC;

Schema:
Inventory(store_name: String, item: String, quantity: integer)
Items(item: String, brand: String, price:double )

I should be able to return the nth most profitable store. TheMySQL command I have functions to create a view in order, but I donot know how to return the index of the ordered table. This is nothomework, just review for an exam.

Expert Answer


Answer to Create a function that determines the nth most profitable store. Receive the value n as a parameter This is the query I … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *