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