Elissa Barnes is web developer at TravelEdge that provides information and reviews on motels and hotels. She is asking your assistance in working with sample XML documents containing data on motels/hotels in the Utah area. She has provided the following data
- motels.xml – list of motels in the area
- amenities.xml – description of amenities at each of the above motels.
- customers.xml – a listing of personal ratings from the customers (1 to 5 star rating)
- prices.xml – price range of all the motels
Elissa wants you to use XQuery to create queries that will provide valuable information to the customers on each of the above establishments. Here are the basic 3 requirements:
1. Write a query to display contact information, amenities, motel ratings and average customer rating for every motel listed in the data file. Sort the query results by the motel ratings in a descending order.
2. Write a query to display all of the motels which have Wi-Fi, a business center, and a gym and for which the median price is less than $120 and the motel rating is 3 or greater.
3. Write a query that display motels which have a pool, free breakfast, allow for pets and for which the low-end price is $90 or less and the average customer rating is 3 or greater.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

for $motel in doc("motels.xml")//motel
let $amenities := doc("amenities.xml")//motel[@motelID = $motel/@motelID]
let $sum := sum(doc("customers.xml")//motel[@motelID = $motel/@motelID]/@customerRating)
let $num := count(doc("customers.xml")//motel[@motelID = $motel/@motelID])
let $rate := $sum div $num

order by $amenities/rating descending

return <motel id="{$motel/@motelID}" title="{data($motel/title)}">
<avgCustomerRating>{format-number($rate, '#.00')}</avgCustomerRating>

By purchasing this solution you'll be able to access the following files:
Solution.docx and Solution1.docx.

for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Web Development (HTML, XML, PHP, JavaScript, Adobe, Flash, etc.) Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats