Add sales report scripts and results
This commit is contained in:
15
sql/create_orders_view.sql
Normal file
15
sql/create_orders_view.sql
Normal 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;
|
||||
Reference in New Issue
Block a user