Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

and this is question 1 1. (10 points) Write a relational algebra plan for the following SQL query: SELECT a.p FROM person_living AS a, male

image text in transcribed

and this is question 1

image text in transcribed

1. (10 points) Write a relational algebra plan for the following SQL query: SELECT a.p FROM person_living AS a, male AS b WHERE a.p b.name AND NOT EXISTS (SELECT* FROM parent child AS c, female AS d WHERE c.p1-d. name AND c.p2-.) You can either draw the query plan as a tree like shown in problem 1, or write it as a linear equation in a text file. If you prefer a text file, to make precedence clear, we ask you to break down your query plan by using at most one operator on each line. For example, given the query in question, you could write it as: T1 (x,p1,p2)person_living(x) Join[x-p1] parent_child(p1,p2) T2(p3,p4)-Rename lp3,p4] parent child(p1,p2) T3 (x,p1,p2 , p3, p4 ) -T1(x,p1,p2) Join [p2-p3] T2(p3, p4 ) T4(p1,p2,y) -GroupBy [p1,p2,count()-yl T3(x, p1,p2,p3,p4) T5 (p1,y) Projectlpl, yl (T4) T6 (p1,z)GroupBy [p1,max(y)->z] T5(p1,y where T1, T2, etc are temporary relations. Note that each line has at most one relational operator. You do not need to use the Greek symbols if you prefer. You also don't need to distinguish among the different flavors of join (just make sure that you write out the full join predicate). We will be grading this part of the homework manually so don't worry too much about the exact syntax of the relation algebra function names etc, as long as we can tell what is going on. 1. (10 points) Write a relational algebra plan for the following SQL query: SELECT a.p FROM person_living AS a, male AS b WHERE a.p b.name AND NOT EXISTS (SELECT* FROM parent child AS c, female AS d WHERE c.p1-d. name AND c.p2-.) You can either draw the query plan as a tree like shown in problem 1, or write it as a linear equation in a text file. If you prefer a text file, to make precedence clear, we ask you to break down your query plan by using at most one operator on each line. For example, given the query in question, you could write it as: T1 (x,p1,p2)person_living(x) Join[x-p1] parent_child(p1,p2) T2(p3,p4)-Rename lp3,p4] parent child(p1,p2) T3 (x,p1,p2 , p3, p4 ) -T1(x,p1,p2) Join [p2-p3] T2(p3, p4 ) T4(p1,p2,y) -GroupBy [p1,p2,count()-yl T3(x, p1,p2,p3,p4) T5 (p1,y) Projectlpl, yl (T4) T6 (p1,z)GroupBy [p1,max(y)->z] T5(p1,y where T1, T2, etc are temporary relations. Note that each line has at most one relational operator. You do not need to use the Greek symbols if you prefer. You also don't need to distinguish among the different flavors of join (just make sure that you write out the full join predicate). We will be grading this part of the homework manually so don't worry too much about the exact syntax of the relation algebra function names etc, as long as we can tell what is going on

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

Example. Evaluate 5n+7 lim 7-00 3n-5

Answered: 1 week ago