Module 3�Relational Algebra
Ms. Khushbu Tikhe
Assistant Professor
Department of Electronics and Computer Science
SLRTCE, Mira Road
Relational Algebra
Unary Relational Operation
Relational Algebra
Set Theory Operation
Binary Operation
Employ Table-2
Student table-1
Select Operation (σ)
Projection Operator (∏)
Rename Operation (ρ)
SET Operation
Union Operation (∪)
Example: Find person who are either student or employee, we can use Union operator like:
Different Operation(−)
STUDENT - EMPLOYEE
Intersection Operation(∩)
STUDENT ∩ EMPLOYEE
Binary Operation�Cartesian product Operation/Cross Product(X)
Example
Division Operator (÷)
attributes = (All attributes of A – All Attributes of B)
STUDENT_SPORTS÷ ALL_SPORTS
The operation is valid as attributes in ALL_SPORTS is a proper subset of attributes in STUDENT_SPORTS.
The attributes in resulting relation will have attributes {ROLL_NO,SPORTS}-{SPORTS}=ROLL_NO
The tuples in resulting relation will have those ROLL_NO which are associated with all B’s tuple {Badminton, Cricket}. ROLL_NO 1 and 4 are associated to Badminton only. ROLL_NO 2 is associated to all tuples of B. So the resulting relation will be:
Join Operation (⋈)
Join Operation
Various forms of join operation are:
Inner Joins:
Outer Join:
Inner Join:
Theta Join:
Example
Student_Detail −
Natural join
Student
STUDENT⋈STUDENT_SPORTS
Equi join
CUSTOMER ⋈ PRODUCT
Outer Join:
Left outer join
Right outer join
Full outer join
Example:
Outer Join: a. Left Outer Join(⟕)
Right Outer Join(⟖)
Full Outer Join(⟗)
Summary
Summary
Summary
Reference