Add sales report scripts and results

This commit is contained in:
2024-11-17 14:47:44 +01:00
parent 70f6458e03
commit aac9358de5
4 changed files with 113 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
-- sales report - task 1
-- changes:
-- interpreted quantity as the number of ordered items, because I assumed that Little lemon wants
-- orders à la carte instead of fixed menus
drop view if exists OrdersView;
create view OrdersView as
select
O.OrderID,
count(OI.MenuItemID) as Quantity,
O.BillAmount as Cost
from Orders as O
inner join OrderItems as OI on O.OrderID = OI.OrderID
group by O.OrderID
having Quantity > 2;