# We give solutions for this more realistic case later

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

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.

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

View Full Document
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.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern