Add query optimization scripts and results

This commit is contained in:
2024-11-17 14:47:57 +01:00
parent aac9358de5
commit 05e2863bfd
4 changed files with 83 additions and 0 deletions

12
sql/get_max_quantity.sql Normal file
View 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