jamraz — 2011-11-02T02:20:59-04:00 — #1
Use subqueries instead of JOIN (inner or outer)
What is the percentage of lost income from unoccupied rooms at each hotel on
July 6 2008? Round to the nearest % using the ROUND function, and use || to
concatenate ‘%’ to your output
r937 — 2011-11-02T05:56:44-04:00 — #2
where's your attempt to solve this?
we don't do homework assignments here
however, we will help you to do them
so, let's see your attempt
guelphdad — 2011-11-02T07:43:51-04:00 — #3
Well we could become a homework club couldn't we?
jamraz — 2011-11-02T20:10:50-04:00 — #4
Sorry about that. I was able to get the loss income for each room but dont know how to turn it into percentage.
SELECT hotelno, SUM(price) FROM room r
WHERE roomno NOT IN
(SELECT roomno FROM booking b, hotel h
WHERE (datefrom <= DATE'2008-07-06' AND
dateto >= DATE'2008-07-06') AND
b.hotelno = h.hotelno)
GROUP BY hotelno;
r937 — 2011-11-03T05:33:34-04:00 — #5
may i ask which database system you ran this on?
sure doesn't look like mysql