Relational Algebra
Relational Algebra
RELATIONLA OPERATION
1. SELECT OPERATION (σ): The Select operation is used to select a subset of the tuples from a
relation that satisfies a select condition.
• Sigma (σ) is used to denote select operation
• The select operator is univory such that it is applied to a single relation
2. Project Operation (π) = project operation selects certain columns from the table and discard
the other columns.
• This operation shows the list of those attributes that we wish to appear in the result.
• Rest of the attributes are Eliminated from the table
The general format for project operation is
Example:-
3. UNION OPERATION (U) :- It perform binary union between two given relations and is defined
as
RUS
Where R and S are either database relation or relation result set (temporary relation)
Union operation to be valid, the following condition must hold
4. Set Intersection (∩):- it performs binary intersection between two given relation and defined
as :-
R∩S
where R and S are either database relations or relation result set
Example
5. Set Difference (-) The Result of the set difference operation is tuples ,which are present in
one relation but are not in the second relation.
R-S
Notation is find all the tuples that are present in R but not in S
Example :-
π name (Student 1) - π name (Student 2 )
6. Cartesian Product (X): combines information of two different relation into one
RXS
Where R and S are relation and
Their output will be defined as
Example :-
ρ x (E)
Where the result of expression E is saved with name of X
Example: - Query to rename the table student to employee and its attributes name, address,
phone number.