Display Guests stayed with Pets in SQL

Question:

Display Guests stayed with Pets

 The resort manager wants to know the guest who brought their children and pet to the resort. Write a query to display the guest id, the resort id, the number of days they stayed (give alias name as numberofdays), count of adults, children and pet, their total charge incurred. Display the output in the descending order of pet count.

Quiz for Exam - Display Guests stayed with Pets

Code:

Main.sql

 select guestid, resortid,(todate-fromdate) as numberofdays, adultcount, childcount, petcount, totalcharge 
 from booking 
 where petcount>0 and childcount>0 
 order by petcount desc;

Recommended:

Leave a Comment

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