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:

1 thought on “Calculate the Sleep Capacity and Bed Rooms for Resort in SQL”

  1. Excellent pieces. Keep posting such kind of information on your
    page. Im really impressed by your site.
    Hi there, You have done a fantastic job. I will definitely digg it and in my opinion recommend
    to my friends. I’m sure they will be benefited from this
    website.

Leave a Comment

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

x