SQL ORACLE Question. Display the hotel name, room number (not id), room descript
ID: 3849069 • Letter: S
Question
SQL ORACLE Question.
Display the hotel name, room number (not id), room description, and rack rate for all rooms with a rack rate at or above $138.00 per night (valid during the month of July), in ascending order, and show the formatted rack rate with a $.
GuestID IDEN ll Y (1500,1) CREDITCARD requires EPK Creditcard!D Smallint has GUEST ROOMTYPE PK GuestID smallint FK1 GuestID smallint CCType varchar (5) GuestFirst varchar (20) CC Number varchar (16) GuestLast varchar (20) CC Company varchar (40) RTDescription varchar (200) Guest Address varchar (30) CCCard Holder varchar (40) Guest Address2 varchar (10) CCExpiration smalldatetime has GuestCity varchar (20) Guest State char(2) GuestPostal Code char(10) RACKRATE Guestcountry varchar (20) has Smallint PK Rack RatelD Guest Phone varchar (20) GuestEmail varchar (30) FK1 RoomTypeID smallint Guest Comments varchar (200 FK2 HotellD nt Smad Rack Rate smal money ROOM RackRateBegin date PK BoomID smallint Rack Rate End date RackRateDescription varchar (200 Room Number varchar (5) RoomDescription varchar (200) has Room Smoking bit HotellD is NOT an Identity Room BedConfiguration char(2) assigned H FK3 HotellD HOTEL nt Sma has FK4 Room TypeID PK Hotel Smallint smallint Bed Config varchar (30) CHECK Hotel Name BILLING Hotel Address varchar (30) K, Q,F,20,2K,2F EPK EolioBillinglD Smallint Hotel City varchar (20) HotelState char(2) has Hotel Country varchar (20) FK1 FoliollD smallint Hotel PostalCode char(10) FK2 BillingCategoryID Smad nt Hotel StarRating char(1) BillingDescription char(30) HotelPictureLink varchar (100) Billing Amount smallmoney FK Tax LocationID smallint BillingitemQty tinyint LT BillingltemDate date located in ns PaymentID IDENTITY (8000 TAXRATE BILLINGCATEGORY PK Tax LocationID smallint PK BillingCategoryID Tax Description varchar (30) ngCatDescription varchar (30) Room Tax Rate decimal (6,4) Ver 1.1 6/5/2017 BillingCatTaxable bit SalesTax Rate decimal (6,4)Explanation / Answer
Here we need to take the inner join to get the data from the tables ROOM, RACKRATE and HOTEL. We also need to use WHERE for condition and ORDER BY clause to get the data in ascending order or rackrate. The desired query is given below
SELECT H.HotelName, R.RoomNumber, R.RoomDescription, RR.RackRate
FROM ROOM R
INNER JOIN RACKRATE RR ON R.RoomTypeID = RR.RoomTypeID
INNER JOIN HOTEL H ON R.HOTELID = H.HOTELID WHERE RR.RackRate >=130 ORDER BY RR.RackRate asc
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.