in Databases
824 views
0 votes
0 votes

0

in a) projection has subscript hid and first select has hCity="Vancouver" and second select has year =2005 as subscript

in b) projection has subscript hid and select has hCity="Vancouver" ^ year is not equal to 2005 as subscript

In second question first projection operator has subscript s_name, title and second projection operaor has title as its subscript

Schema for second-

book(acc_no,yr_pub,title)

user(card_no,b_name,b_address)

supplier(s_name, s_adder)

borrow(acc_no, card_no,doi)

supp(acc_no, s_name, price,dos)

in Databases
by
824 views

3 Answers

0 votes
0 votes
Option B select id of Hotels which are not booked in year 2005 but it will not select those hotels which are not even booked..
If Natural Join replaced by cross product then result must be same as option A.

Option A already gives hotels id which are not booked in year 2005..
0 votes
0 votes

answer will be c option 

explanation:-  in option (a) ^id(sigmhcity="vancour"(hotel)) gives table which contain all the hid which hav hcity ="vancouver" 

hid
 
 
 

pieid(sigmayear=2005 (booking)) it gives table containing atrribute HID with element year =2005

HID
 
 

  if we subtract 2nd from 1st then it will give table with attribute HID with element year !=2005

HID
 

in (b) option (sigmahcity='vancour'^year!=2005(booking(natural join)hotel)) gives table with cartesian product booking and hotel with attribute(gid,hid,hname,h address,h_city,room_no,from_date,year,no_of_days)  but year value doesnot = 2005

when we apply pieid on that it will give required answer so both answer will be right 

edited by

1 comment

But as suggested by @laser second will not give those hotels which were not booked at all
0
0
0 votes
0 votes

in second question sigmacard_no=753(borrow(natural join)book) gives table containing attributes(yr_pub,title,cc_no,card_no,doi) after applying pietitle it gives table containing only title atttribute under card no =753                                       (second algebra)

now pies_name,title(supply(natural join)book) gives table with attribute(s_name,title) containing all the supplier name and title       (first algebra)

now we divide first by second then it will give only those supplier name where title name of second matches with title name first thus it will provide name of all the suppliers who supplied all the copies of book under card-no =753

3 Comments

so which is the correct option ??
0
0
option c is correct
0
0

for both question answer will be (c)

0
0

Related questions