WEEK 4 CIS 205 Relational Algebra Full
WEEK 4 CIS 205 Relational Algebra Full
WEEK 4 CIS 205 Relational Algebra Full
Relational Algebra
Relational Algebra is :
Operators in relational algebra are not necessarily the same as SQL operators,
even if they have the same name.
Terminology
R
A 1
B 2 R UNION S
D 3 A 1
F 4 B 2
E 5 C 2
D 3
S E 5
A 1 F 4
C 2 E 4
D 3
E 4
INTERSECTION Example
R
A 1
B 2 R |NTERSECTION S
D 3
F 4 A 1
E 5 D 3
S
A 1
C 2
D 3
E 4
DIFFERENCE Example
R
A 1
B 2 R DIFFERENCE S
D 3
F 4 B 2
E 5 F 4
E 5
S
A 1 S DIFFERENCE R
C 2
D 3 C 2
E 4 E 4
CARTESIAN PRODUCT
The Cartesian Product is also an operator which
works on two sets. It is sometimes called the
CROSS PRODUCT or CROSS JOIN.
There are three forms of the outer join, depending on which data is to be
kept.
• LEFT OUTER JOIN - keep data from the left-hand table
• RIGHT OUTER JOIN - keep data from the right-hand table
• FULL OUTER JOIN - keep data from both tables
OUTER JOIN Example 1