Resortwise Revenue Generated in SQL

Question:

Resortwise Revenue Generated

Write a query to display the revenue generated by each resort. Display the resortid, name of the resort ,booking count and the total amount collected in each resort. Sort the result by resort id. 

Give alias name as TOTALBOOKING to booking count and TOTALAMOUNT to total amount collected. 

Resortwise Revenue Generated

Code:

Main.sql

select b.resortid, (select resortname from resort rs where rs.resortid=b.resortid ) as "RESORTNAME",
count (b.bookingid) as TOTALBOOKING, sum (b.totalcharge) as
TOTALAMOUNT
from booking b
group by b.resortid
order by 1;

Recommended:

Leave a Comment

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