Add query optimization scripts and results
This commit is contained in:
12
sql/get_max_quantity.sql
Normal file
12
sql/get_max_quantity.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
-- query optimization - task 1
|
||||
-- changes:
|
||||
-- interpreted quantity as the number of items in an order, because I assumed that Little lemon wants
|
||||
-- orders à la carte instead of fixed menus
|
||||
|
||||
create procedure GetMaxQuantity () -- noqa: disable=CP03
|
||||
select count(OI.OrderItemID) as MaxQuantityInOrder
|
||||
from MenuItems as MI
|
||||
inner join OrderItems as OI on MI.MenuItemID = OI.MenuItemID
|
||||
group by OI.OrderID
|
||||
order by MaxQuantityInOrder desc
|
||||
limit 1
|
||||
Reference in New Issue
Block a user