Guest details and Total Charges paid
Display guest details who paid total charges RS.50000 and above. Write a query to fetch Guest id, Guest name and Sum of total charges. Give alias name to total charges as TOTALPAID. Sort the result by guest id.
select guest.guestid, guest.name, sum(booking.totalcharge) as TOTALPAID from guest join booking on booking.guestid=guest.guestid group by guest.guestid,guest.name having sum(booking.totalcharge)>=50000 order by guest.guestid;