Calculate the Sleep Capacity and Bed Rooms for Resort in SQL

Question:

Calculate the Sleep Capacity and Bed Rooms for Resort

Guest wants to know the resort id , bed room count and sleeping capacity if the resort has total of 60 or more bed rooms and 100 or more sleeping capacity.

Display the resort id total bed room count as TotalRoom and its total sleep capacity as Capacity. The output should be in the ascending order of resort id.

Calculate the Sleep Capacity and Bed Rooms for Resort

Code:

Main.sql

select distinct resortid, sum(bedroomcount) as TotalRoom, sum(sleepcapacity) as Capacity 
from cabin
group by resortid
having sum(bedroomcount)>=60 and sum(sleepcapacity)>=100
order by resortid;

Recommended:

Leave a Comment

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