L09 - Relational Algebra 3

L09 - Relational Algebra 3 - Remember from Monday the...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Remember from Monday Remember from Monday the Relational Algebra the Relational Algebra with some operators added with some operators added ± Procedural language ± Six basic operators ² select: σ ² project: ² union: ² set difference: ² Cartesian product: x ² rename: ρ ± and four additonal operators ² Set intersection ² Natural join ² Division ² Assignment
Background image of page 1

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

View Full DocumentRight Arrow Icon
We discussed definition of: We discussed definition of: ± Set intersection ² r s = r –( r s ) ± Natural join ² given relations r defined on R and s defined on S ± If A 1 , A 2 , …, A n R S then ± r.A 1 ,… r.A n ( σ r.A 1 = s.A 1 r.A n = s.A n ( r × s )) ± Division ² Let r(R) and s(S) be relations, and let S R ± r ÷ s = R-S ( r )– R-S ( ( R-S ( r )x s ) – R-S,S ( r )) ± Assignment ² Stopped on Monday just before getting to this one
Background image of page 2
Assignment Operation Assignment Operation ± The assignment operation ( ) provides a convenient way to express complex queries. ² With it, you can write query as a sequential program consisting of ± a series of assignments ± followed by an expression whose value is displayed as a result of the query. ² Assignment must always be made to a temporary relation variable. ± Example: Write r ÷ s as temp1 ←∏ R-S ( r ) temp2 ←∏ R-S (( temp1 x s ) – R-S,S ( r )) result = temp1 temp2 ² The result to the right of the is assigned to the relation variable on the left of the . ² May use variable in subsequent expressions.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Banking Scenario Queries with the new operators Banking Scenario Queries with the new operators ± Find the names of all customers who have a loan and an account at bank. customer_name ( borrower ) customer_name ( depositor ) ± Find the name of all customers who have a loan at the bank and the loan amount customer_name, loan_number, amount ( borrower loan )
Background image of page 4
More Examples More Examples --- --- ± Find all customers who have an account from at least the “Downtown” and the “Uptown” branches. ² query 1
Background image of page 5

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

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/08/2008 for the course EE 468 taught by Professor Conry during the Spring '08 term at Clarkson University .

Page1 / 19

L09 - Relational Algebra 3 - Remember from Monday the...

This preview shows document pages 1 - 6. Sign up to view the full document.

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