Upcoming SlideShare
×

# [Www.pkbulk.blogspot.com]dbms04

408 views

Published on

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

Published in: Technology, Education
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
408
On SlideShare
0
From Embeds
0
Number of Embeds
171
Actions
Shares
0
0
0
Likes
0
Embeds 0
No embeds

No notes for slide

### [Www.pkbulk.blogspot.com]dbms04

1. 1. 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).
3. 3. 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