We give solutions for this more realistic case later

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

View Full Document Right Arrow Icon
We give solutions for this more realistic case later. 5 person name ( s company name 6= “±irst Bank Corporation” ( w orks )) If people may not work for any company: 5 person name ( employee ) 5 person name ( s ( company name = “±irst Bank Corporation” ) ( w orks )) c. 5 person name ( w orks ) ( 5 w orks . person name ( w orks 1 ( w orks . salary w orks 2 . salary w orks 2 . company name = “Small Bank Corporation” ) r 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 1 u s ) can be deFned as ( r 1 u s ) (( r 5 R ( r 1 u 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 1 u s ) can be deFned as ( r 1 u s ) (( null , null ,..., null ) × ( s 5 S ( r 1 u 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 1 u s ) can be deFned as ( r 1 u s ) (( null , null ,..., null ) × ( s 5 S ( r 1 u s ))) (( r 5 R ( r 1 u s )) × ( null , null ,..., null )) The Frst 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 deFned as follows. Let r ( R )and s ( S ) be relations, and let S R ;thatis , 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 ifandonlyifbothoftwo conditions hold: t is in 5 R S ( r ) ±or 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 deFnition: a. Write a relational algebra expression using the division operator to Fnd the IDs 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 deFne the division operation using the other relational algebra operations.) Answer: a. 5 ID ( 5 ID , course id ( takes ) ÷ 5 course id ( s dept name = ’Comp. Sci’ ( course )) b. The required expression is as follows: r 5 ID , course id ( takes
Background image of page 3
4 Chapter 6 Formal Relational Query Languages s 5 course id ( s dept name = ’Comp. Sci’ ( course )) 5 ID ( takes ) 5 ID (( 5 ID ( takes ) × s ) r ) In general, let r ( R )and s ( S ) be given, with S R .Thenwecanex- press the division operation using basic relational algebra operations as follows: r ÷ s = 5 R S ( r
Background image of page 4

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

View Full Document Right Arrow Icon
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page2 / 8

We give solutions for this more realistic case later 5...

This preview shows document pages 2 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online