Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Calculate the cost of the three strategies cited in example 2 3 . I if the Staff relation has 1 5 0 0 0 tuples,
Calculate the cost of the three strategies cited in example I if the Staff relation has tuples, Branch tuples, there are Managers one for each branch and there are London Branches.
EXAMPLE Comparison of different processing strategies
Find all Managers who work at a London branch.
We can write this query in SQL as:
SELECT
FROM Staff s Branch b
WHERE sbranchNo bbranchNo AND
sposition 'Manager' AND bcity 'London';
Generate Relational Algebra Trees RAT as described in the Analysis Phase of Query Decomposition for Pblmac pg
following queries are semantically correct:
a SELECT rtype, rprice
FROM Room Hotel
WHERE rhotelnumber hhotelnumber AND hhotelname 'Grosvenor Hotel' AND rtype ;
b SELECT gguestNo,
gname
FROM Hotel h Booking b Guest g
WHERE h hotelNo bhotelNo AND h hotelName 'Grosvenor Hotel';
c SELECT rroomNo, hhotelNo
FROM Hotel Booking b Room r
WHERE hhoteINo bhoteINo AND h hotelNo AND broomNo rroomNo AND type S
AND bhotelNo H;
Exercises
The following tables form part of a database held in a relational DBMS:
Hotel hotelNo hotelName, city
Room roomNo hotelNo, type, price
Booking hotelNo guestNo, dateFrom, dateTo, roomNo
Guest guestNo guest Name, guestAddress
where Hotel contains hotel details and hotelNo is the primary key;
Room contains room details for each hotel and room No hotelNo forms the primary key;
Booking contains details of bookings and hotelNo guestNo, dateFrom forms the primary key;
Guest contains guest details and guest No is the primary key.
Query Decompo
Root
Intermediate operations
Leaves
Conjunctive normal form: A sequence of conjuncts that are connected with the
AND operator. Each conjunct contains one or more terms connected by the
operator. For example:
'Manager' salary ranchNo
A conjunctive selection contains only those tuples that satisfy all conjuncts.
Disjunctive normal form: A sequence of disjuncts that are connected with the vvOR
operator. Each disjunct contains one or more terms connected by the AND
operator. For example, we could rewrite the previous conjunctive normal form as:
'Manager' ranchNo salary branchNo
A disjunctive selection contains those tuples formed by the union of all tuples that
satisfy the disjuncts.
The RAT solutions can be hand drawn with the images pasted into the Word document.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started