# Relational Algebra- question & answer

Relational algebra

The set of rules used to manipulate data in a relational database can be expressed in an algebraic format called relational algebra.

Categories of relational algebra operations

1. One fundamental and additional operation

2. Set of oriented and relational oriented operation

3. Unary and binary operation

Select σ

Project π

Cross-product X

Set difference –

Rename ρ

Join ☒

Set intersection ⋂

Division ÷

2. Set Oriented and Relational Oriented operation

Union

Intersection

Set difference

cross product

Select

project

join

division

Rename

3. Unary and Binary Operations

Select

Rename

Cross Product

Set difference

Set intersection

Union

Join

Division

Select operation

The selection operation is used to select the subset of rows from a relation that satisfies a selection condition. It is represented by the symbol σ

Project operation

The project operation is used to select the subset of the column from the relation it is represented by the symbol π

Rename operation

The Rename operation can be used to change both the relation’s name and the name of the attribute of a relation. It is represented by the symbol ρ

Cross or  cartesian product- X

The cartesian product of two relations R1 and R2 is a relation formed by taking each tuple fromR1 and combining it with every tuple from R2.

Set union

The set union operation finds the data that occurs in either or both the relations involved.

Set intersection

The set intersection operation finds the data that occurs in both the relation only.

Set difference

The set difference operation finds the data that only occurs in one relation but not in other.

Join operation

A join is a binary operation that is used to combine related tuples from two relations into a single Temple

Theta join operation

It is a join form with the general condition on to relation. The condition is of the form (condition1) and (condition2) and (conditionn) where each such a condition may be involved a comparison operator.

Division

Query that include for all every (R1÷R2)

Equijoin operation

In this type of join we have a join with only equality operation

Natural join

It is a binary operation that first forms a cartesian product between the relation. It then selects only those tuples with equality on pairs of common attributes that appear in both relation, and finally remove the duplicate attributes.

Outer join

A join operation is formed between two relations and without eliminating tuple from one relation that do not have related tuples in the other relation.

Leftt outer join

Such a join is formed by combining related tuples from both the relations in addition to the tuples from the left relation that do not have a match with the right relation.

Right outer join

Such a join is formed by combining related tuples from both the relations in addition to tuples from the right relation that do not have a match with the left relation.

Full outer join

Such a join is formed by combining related tables from both the relation in addition to tuples from the left and right relation that do not have a match with the other relation.