• Save
Upcoming SlideShare
×

Like this document? Why not share!

# [Www.pkbulk.blogspot.com]dbms04

## on Jun 15, 2013

• 327 views

Introduction to database lecture# 4: This lecture is all about Relational Algebra and its theory etc

Introduction to database lecture# 4: This lecture is all about Relational Algebra and its theory etc

### Views

Total Views
327
Views on SlideShare
155
Embed Views
172

Likes
0
0
0

### 7 Embeds172

 http://pkbulk.blogspot.com 104 http://www.pkbulk.blogspot.com 56 http://www.pkbulk.blogspot.fr 4 http://www.pkbulk.blogspot.co.uk 3 http://www.pkbulk.blogspot.com.br 2 http://www.pkbulk.blogspot.de 2 http://www.pkbulk.blogspot.com.ar 1
More...

### Report content

• Comment goes here.
Are you sure you want to

## [Www.pkbulk.blogspot.com]dbms04Document Transcript

• Relational Algebra1Fall 2001 Database Systems 1Relational Algebra• A relation is a set of tuples. Each relationalalgebra operation takes as input a list ofrelations and produces a single relation.• General form:OperatorArguments (List of Relations) New Relation• After each operation, the remaining attributesare carried to the new relation. The attributesmay be renamed, but their domain remains thesame.Fall 2001 Database Systems 2Set Theoretic Operations• Regular set operations on relations• A set operation requires two participating relations R andS to be compatible– R and S should have the same attributes• R(Name:D1, Email:D2)• S(Name:D1, Email:D2, Address:D3)• T(Name:D1, Email:D4)• V(Name:D1, Email:D2)Which relations above are union (set operation)compatible?– Union compatibility may require type conversion(casting).
• Relational Algebra2Fall 2001 Database Systems 3Set Operations ¢¡¤£¦¥ §©¨£ ¥¡  "! #¤"\$%¥&()&0¥\$"¡1\$) 243©5 673SR ∪8 9 @BADC7E F©GIHQP©RDHSR©T¤FF 5H QPUFVT 5 3 8 6 T 9W 3 H¤FVTGQFVXYH 56 V3SR ∩8 9 @BADC7E F©GIHQP©RDHSR©T¤F` 6 HDP 5 3 8aR 3Yb 9c 5d Qd FVT¤F 3 XQFSR −8 9 @BADC7E F©GIHQP©RDHSR©T¤F 5 38e`¦AQH 36 H 5 3 9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffgggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiFall 2001 Database Systems 4pYq¢rs0t%u pQvw r¤xy¤ yx0vY (Y  Smith@aol.comY " Johns@geocities.com d0e gf) Brown@netmail.comh i1e jk Gray@microsoft.coml0m)n)o0p0q lr s0tu vwxy o0x w0tz{%| })~   Gray@microsoft,com{% g~   Robert432@aol.com{0 "g Johns@somewhere.com{ " g Jj@yahoo.com{0 (g Duke@jazz.comg¤0Q 0 Q    g¡  ¢g£g £g¤¥%¦ §Y¦ ¨)© ª«¬­ ®¯­ ° ¯g±¥%² §Y² ³1´µgµ´± ¶U®%´· ¸ ¹ ¯gº­ ° ¯±¥0» §Y² ¼"¬%«¬­ © ¯gµ¬ ½¤¬¾¦¿"¯· À¥Á §» Â¯gÃ¤µª­ ­ ³"ª« «ª­Ä0Å ÆÇ ÈÉ ÊËgÌ¤ÍÊÎÏÐÉÑÒ ÓÔ Ô Ê Õ"ÖÓ× ×ØÖÄ0Ù ÆYÚ Æ¤ÛÑËÜÝÉÑÛÖ ÞÊÔ × Êgßàá"â%ã à%äå â%æç è áäå à0éêgáå ë1ì¤íégî çï0ðñ%ò ó0ôõö ÷%ò ï"ø òùï0ðñ%ø ó0ôõö ÷gú ï%ù û0ùï0ðñ0õ ó0ôõ%ò ÷%ò ïú òóï0ðñgú ü%ôgò ÷0ù ï%ù ý%ùï0ðñ0ù ü%ôgò ÷%ò ï"ø øgöï0ðñ0û ü%ôgø ÷gú ïú ýöï0ðñý ü%ôgø ÷%ø ï"ò úï0ðñ0ó ü%ôõ ÷%ø ï%õ ù
• Relational Algebra3Fall 2001 Database Systems 5Assignment and Alias• Given a relation R, head(R)=A1…An is the list of attributesin R.• For each attribute, dom(A) gives the domain of A,name(A) gives the name of the attribute• Suppose B1…Bn is a list of attributes such that for each i,dom(Bi) = dom(Ai)Then assignment (:=) changes the names of some or all ofthe attributes in R and results in a new relation S,S(B1…Bn) := R(A1…An)and dom(B1) = dom(A1) … dom(Bn) = dom(An).Fall 2001 Database Systems 6Set Operations• Find all people who are registered as buyers or owners ¢¡¤£¦¥¨§©   ! !" #\$&% )(10 243 Smith@aol.com\$65 798@3¤ACB Johns@geocities.comDE% F¦GIHCP Gray@microsoft.comQRQRQ QRQ@Q QRQRQBUYERS-2(oid,name,email) :=BUYERS(buyid,name,email)RESULT := BUYERS-2 ∪ OWNERS