Download presentation
Presentation is loading. Please wait.
Published byChristopher Parsons Modified over 9 years ago
1
Relational Algebra MBAD 613 R. Nakatsu
2
Relational Data Manipulation Language Query-by-Example; Query-by-Form Transform-Oriented Languages Relational Algebra Relational Calculus
3
DML Interfaces Forms Query Language Interface SELECT Name, Age FROM PATIENT WHERE Physician = ‘Levy’ © 2000 Prentice Hall
4
Domain Definitions © 2000 Prentice Hall
5
Domain Compatibility Page 204 Two domains are domain compatible if 1) they have the same number of attributes and 2) each corresponding attribute has the same domain.
6
Attribute Domains © 2000 Prentice Hall
7
Relational Operators 1.Union (A U B or A + B) 2.Difference (A – B) 3.Intersection (A ∩ B) 4.Projection 5.Selection 6.Product (A X B) 7.Join (equijoiin, outer join) 8.Division (A / B)
8
1. Union Adding tuples from one relation A to those of a second B. Denoted A + B or A U B. A and B must be domain compatible. © 2000 Prentice Hall
9
2. Difference Includes tuples that occur in the first relation A but not the second B. Denoted A - B. A and B must be domain compatible. © 2000 Prentice Hall
10
3. Intersection Includes tuples that are in both the first relation A and the second relation B. Denoted A ∩ B. A and B must be domain compatible. © 2000 Prentice Hall
11
4. Projection Selects specified attributes (columns) from a relation” © 2000 Prentice Hall
12
5. Selection Selects tuples (rows) from a relation. © 2000 Prentice Hall
13
6. Product The product of two relations (sometimes called the Cartesian Product) is the concatenation of every tuple of one relation A with every tuple of a second relation B. Denoted A X B
14
7. Join The join operator allows us to combine information from two or more tables. It is a combination of the product, selection, and (possibly) projection operations. Two basic types: -equijoin: includes only matched pairs –outer join: the unmatched pairs are retained, and the values are left null.
15
Equijoin, Natural, Left Outer © 2000 Prentice Hall
16
8. Division Find those values in the first relation A that are related to all of the values in the second relation B. Denoted A / B
17
Example: Division a a1 a2 a3 b b1 b2 b1 b2 b3 b b1 b2ABB What is AB / B?
18
Example DataStudentEnroll Course
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.