{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

We give solutions for this more realistic case later

Info iconThis preview shows pages 2–4. Sign up to view the full content.

View Full Document Right Arrow Icon
We give solutions for this more realistic case later. person name ( company name = “First Bank Corporation” ( w orks )) If people may not work for any company: person name ( employee ) person name ( ( company name = “First Bank Corporation” ) ( w orks )) c. person name ( w orks ) ( w orks . person name ( w orks ( w orks . salary w orks 2 . salary w orks 2 . company name = “Small Bank Corporation” ) w orks 2 ( w orks ))) 6.3 The natural outer-join operations extend the natural-join operation so that tuples from the participating relations are not lost in the result of the join.
Background image of page 2

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Practice Exercises 3 Describe how the theta-join operation can be extended so that tuples from the left, right, or both relations are not lost from the result of a theta join. Answer: a. The left outer theta join of r ( R ) and s ( S ) ( r s ) can be defined as ( r s ) (( r R ( r s )) × ( null , null , . . . , null )) The tuple of nulls is of size equal to the number of attributes in S . b. The right outer theta join of r ( R ) and s ( S ) ( r s ) can be defined as ( r s ) (( null , null , . . . , null ) × ( s S ( r s ))) The tuple of nulls is of size equal to the number of attributes in R . c. The full outer theta join of r ( R ) and s ( S ) ( r s ) can be defined as ( r s ) (( null , null , . . . , null ) × ( s S ( r s ))) (( r R ( r s )) × ( null , null , . . . , null )) The first tuple of nulls is of size equal to the number of attributes in R , and the second one is of size equal to the number of attributes in S . 6.4 ( Division operation ): The division operator of relational algebra, ÷ , is defined as follows. Let r ( R ) and s ( S ) be relations, and let S R ; that is, every attribute of schema S is also in schema R . Then r ÷ s is a relation on schema R S (that is, on the schema containing all attributes of schema R that are not in schema S ). A tuple t is in r ÷ s if and only if both of two conditions hold: t is in R S ( r ) For every tuple t s in s , there is a tuple t r in r satisfying both of the following: a. t r [ S ] = t s [ S ] b. t r [ R S ] = t Given the above definition: a. Write a relational algebra expression using the division operator to find the ID s of all students who have taken all Comp. Sci. courses. (Hint: project takes to just ID and course id , and generate the set of all Comp. Sci. course id s using a select expression, before doing the division.) b. Show how to write the above query in relational algebra, without using division. (By doing so, you would have shown how to define the division operation using the other relational algebra operations.) Answer: a.
Background image of page 3
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}