Forum

SQL Query to displa...
 
Notifications
Clear all

SQL Query to display BOOKING and the PAYMENT made y the Guest


Rahul Updhyay
Posts: 17
Topic starter
(@rahul)
Active Member
Joined: 1 year ago

Write a query to display the booking and the payment made by the guest. Display guest name, resort name, from date, to date, adult count, child count, and total charges made by guest. Sort the output in the ascending order of the guest. 

2 Replies
Deepak Raj
Posts: 18
 Deepak Raj
(@Deepak Raj)
Joined: 1 year ago

You can try this query 

Select a.bookingID, a.totalcharge, b.name as GuestName, c.ResortName,
a.todate,a.fromdate,a.adultCount, a.childCount, a.totalcharge
from
Booking a,
Guest b,
Resort c
Where
a.guestid=b.guestID AND b.resortID=c.resortID
Order by b.guestid asc
Reply
jeevan 123
Posts: 6
(@jeevan303500)
Active Member
Joined: 4 months ago

Query to display the booking and the payment made by the guest. Display guest name, resort name, from date, to date, adult count, child count, and total charges made by guest. Sort the output in the ascending order of the guest.

Select guest.name,
resort.resortname,
booking.fromdate,
booking.todate,
booking.adultcount,
booking.childcount,
booking.totalcharge
from guest  join booking 
           on guest.guestid=booking.guestid
           join resort 
           on booking.resortid= resort.resortid
order by guest.guestid;
Reply
Share: