
How do I convert this to relational algebra tree?
What are the logical steps? Do I first need to convert to relational algebra? Or can I go straight from sql to tree?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would first convert to relational algebra, then convert to the tree.
Look, the
SELECTclause only wants three fields. That’s aprojection.The
FROMclause has three relations. That’s aCartesian product.The
WHEREclause gives a bunch ofselections. This is the part where it helps to convert to relational algebra before converting to a tree.I have no idea what notation you use in class, but you probably want something that has a general form of
or projection of selection of selection of … stuff resulting from cross products.
Note, depending on how picky your instructor is, you may have to rename fields. Since both Show and Seat have showNo as an attribute, you may not be allowed to take the cross product before giving them unique names (alternative rules, attributes are uniquely identified by an implicit relation name prefix).
Furthermore, depending on the purpose of the lesson, you may commute some of these operations. You can do a selection on Booking before taking the cross product as a means of restricting the date range. The end results will be equivalent.
Anyway, is it really that much extra work to go from sql to relational algebra to tree? I have no doubt that with practice, you could skip the intermediate step. However, since you asked the question in the first place, I would suggest going through the motions. Remember the “show your work” requirement from junior high math teachers for the combining of simple terms that went away in high school? Same rule applies here. I say this as a former grader of CS assignments.