Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

34. Complete and print your statements and results by spooling your file (with e

ID: 3708229 • Letter: 3

Question

34.          Complete and print your statements and results by spooling your file (with echo on from Oracle if available).

List the ResNum and total charged for each room in reservation 1005. Use the following column headings: ResNum, Nights, Total. Hint: You will need to calculate the number of nights to calculate the total charged for each room, but you will not show the number of nights in your output.

ResDetail Customer CustlD CustFName CustLName CustPhone CustType LoyaltylD Reservation ResID CheckinDate CheckOutDate CustID AgentID ReslD Room CustType CustType CustTypeDesc RoomNum RateType RateAmt RoomType Agent AgentlD AgentFName AgentLName AgentType RateType RateType RateTypeDesc RoomType RoomType RoomTypeDesc AgentType AgentType AgentTypeDesc

Explanation / Answer

In the given schema there is no such attribute with ResNum. Instead I am using ResID for reservationID. The query to list ResID and total charged for each room is given below.

For the reservation id 1005, for each room total amount us calculated.

Query-

SELECT res.ResID, rd.RoomNum, ((CheckOutDate - CheckInDate) * RateAmt) AS total
FROM Reservation res
INNER JOIN ResDetail rd
ON res.ResID = rd.ResID
WHERE res.ResID = 1005;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote