Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following relational database schema (primary keys are underlined) and SQL query: Hotel ( hotelNo , hotelName, city) Room ( roomNo , hotelNo ,

Consider the following relational database schema (primary keys are underlined) and SQL query:

Hotel (hotelNo, hotelName, city) Room (roomNo, hotelNo, type, price) Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo) Guest (guestNo, guestName, guestAddress)

SELECT g.guestNo, g.guestName FROM Room r, Booking b, Hotel h, Guest g WHERE h.hotelNo = b.hotelNo AND g.guestNo = b.guestNo AND h.hotelNo = r.hotelNo AND h.hotelName = "Ritz" AND dateFrom >= "Jan 01, 2001" AND dateTo <= "Dec 31, 2001";

(A) state what information they retrieve (B) give a corresponding Relational Algebra expression (C) draw the initial canonical query tree (D) use heuristic optimization to transform it into the most efficient query tree possible. (E) Compare the cost of at least two different query plans for the given queries. You can make appropriate assumptions for the database statistics (F) Suggest what appropriate indexes should be built upon the given relations to improve the query performance. Justify your answer

Show all intermediate steps and transformations in detail. You can make appropriate assumptions for the database statistics to support your claim.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions