Guest who paid highest charges in SQL

Question:

Guest who paid highest charges

 Write a query to display the guestid and guest name who was charged highest amount in the resort. Sort the output on the guestid.

Guest who paid highest charges

Code:

Main.sql

select g.guestid, g.name
from guest g left join booking b
               on b.guestid=g.guestid
               where b.totalcharge=(select max(totalcharge) from booking)
   order by 1;

Recommended:

Leave a Comment

Your email address will not be published. Required fields are marked *