Maximum amount paid by Guest
Managements wants to know guest and maximum amount paid by each guest for any of the bookings.
Write a query to display the Guest ID, Guest name and maximum amount paid by them(give alias name as MAX_AMOUNT). Sort the result based on guest ID.
select g.guestid, g.name, max(b.totalcharge) as MAX_AMOUNT from guest g join booking b on b.guestid=g.guestid group by g.guestid, g.name order by 1;