select * from RestaurantTable t
inner join Waiter w ON t.Waiter = w.ID
where t.WindowSite = 1

select * from Customer c
inner join OrderLine o ON c.Phone = o.CustomerNo
where c.CName = 'King Arthur'

select * from Customer c
inner join OrderLine o ON c.Phone = o.CustomerNo
order by c.CName

select * from Customer c
inner join OrderLine o ON c.Phone = o.CustomerNo
inner join MenuItem m ON m.MenuItemNo = o.MenuItemId
where c.CName = 'King Arthur'

select c.CName, Sum(m.Price) As totalprice from Customer c
inner join OrderLine o ON c.Phone = o.CustomerNo
inner join MenuItem m ON m.MenuItemNo = o.MenuItemId
group by c.CName 
having c.CName like 'King%'


select Sum(m.Price) As totalprice from Customer c
inner join OrderLine o ON c.Phone = o.CustomerNo
inner join MenuItem m ON m.MenuItemNo = o.MenuItemId
inner join Booking b ON c.Phone = b.CustomerNo
where 
datepart(year,b.DayAndTime) = 2018 
And datepart(MONTH,b.DayAndTime) = 2
And datepart(DAY,b.DayAndTime) = 16
 

select Sum(m.Price) As totalprice, b.DayAndTime, (select c.CName from customer c where c.Phone = b.CustomerNo) as 'Customer Name' from Customer c
inner join OrderLine o ON c.Phone = o.CustomerNo
inner join MenuItem m ON m.MenuItemNo = o.MenuItemId
inner join Booking b ON c.Phone = b.CustomerNo
group by b.DayAndTime, b.CustomerNo 
having datepart(hour,b.DayAndTime) > 8  
And ( datepart(hour,b.DayAndTime) <= 10 AND datepart(MINUTE,b.DayAndTime) < 30 )

