Question: 1 . 2 Write a relational algebra from this question using bag semantic. - - Question 1 . 1 SELECT users.usercode AS UserCode, AVG (

1.2 Write a relational algebra from this question using bag semantic.
--Question 1.1
SELECT users.usercode AS UserCode,
AVG(hotels.pricepernight * hotels.days) AS AvgHotelPrice
FROM users
JOIN hotels ON users.usercode = hotels.usercode
GROUP BY UserCode;
1.4 Write a relational algebra -- Question 1.3
SELECT H1.travelcode AS TravelCode,
H1.usercode AS UserCode
FROM hotels H1
JOIN hotels H2 ON H1.hotelname = H2.hotelname
AND H1.checkindate < H2.checkoutdate
AND H2.checkindate < H1.checkoutdate
WHERE H1.travelcode <> H2.travelcode
AND H1.usercode = H2.usercode;
--Question 1.4: Write a relational bag semnatic algebra for this question:
SELECT travelcode,
flightprice +(pricepernight * days) AS TotalCost,
CASE
WHEN flightprice +(pricepernight * days)>3000 THEN 'Luxury'
WHEN flightprice +(pricepernight * days)<1000 THEN 'Cheap'
ELSE 'Regular'
END AS TripClass
FROM hotels
JOIN flights ON hotels.travelcode = flights.travelcode;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!