-- 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
