First Wish you a Happy New Year
Sorry about the first one. Actually I was just checking “not in” operator.
Thanks for correcting the next two.
I’ve tried, these give correct results.
BList the names of hotels which are located in more than two cities[/B]
SELECT hname,COUNT(city) AS 'No. Of Cities'
FROM Hotel
GROUP BY hname
HAVING COUNT(city) > 2;
BFor a given hotel(hno supplied) list total no. of room of different type.[/B]
SELECT type, COUNT(type) AS 'No. of Rooms'
FROM Room
WHERE hno = 13
Group BY type
BFor a given hotel(hname supplied) list total no. of room of different type.[/B]
SELECT type, COUNT(type) AS 'No. of Rooms'
FROM Room R INNER JOIN Hotel H ON R.hno=H.hno
WHERE hname = 'The Amber'
Group BY type
BList names of hotels which have minimum charge for Luxury room for a given city.[/B]
SELECT hname,min(charge) AS 'Min. Charge'
FROM Room R INNER JOIN Hotel H ON R.hno=H.hno
WHERE city = 'Kolkata' AND type = 'Luxury'
GROUP BY hname
BList names of all hotels where charge of Luxury room is between 3000 and 4000[/B]
SELECT hname
FROM Room R INNER JOIN Hotel H ON R.hno=H.hno
WHERE charge BETWEEN(3000) AND(4000) AND type = 'Luxury'
GROUP BY hname
BCount the number of bookings of Luxury room in a given hotel in 2012.[/B]
BFind out total earnings of a hotel in 2012.[/B]
SELECT SUM(charge) AS 'Total Earnings'
FROM Room R INNER JOIN Booking B ON R.hno=B.hno JOIN Hotel H ON R.hno=H.hno
WHERE H.hname = 'Hayatt Hotel'
AND B.idate BETWEEN('2012-01-01') AND('2012-12-31')
This gives [B]NULL[/B] results
BFind guest name that has booking on Luxury Room in 2013.[/B]
Do I have to link 3 tables in (9) & (11)
Please tell how do I find the last three.