×

Like this document? Why not share!

# [Www.pkbulk.blogspot.com]dbms04

## by AnusAhmad on Jun 15, 2013

• 261 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
261
Views on SlideShare
89
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...

## [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 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