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.

SQL Code: Guest details and Total Charges paid Solution
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;
Related:
- Review Comments Shared by Guest in SQL
- Maximum amount paid by Guest in SQL
- pointofinterest locations in each Town in SQL
- Payments made by Guest in SQL
- Fetch Resort Details in SQL
- Review Comment for all Resort in SQL
- Review Comment for star rating Resort in SQL
- Resort that charges the highest in SQL
- Cities having Summer Temperature More than Jaipur in SQL
- PointOfInterest Locations in Chennai in SQL
- Resort with Least Capacity in SQL
- Guest who paid highest charges in SQL
- Create View_BMS in SQL