⇒ Relational Algebra is a procedural query language which takes a relation as an input and generates a relation as an output.
⇒ Relational Algebra is a language for expressing relational database queries.
⇒ It uses operators to perform queries.
⇒ Relational algebra operations are performed recursively on a relation.
⇒ Relational algebra operations work on one or more relations to define another relation without changing the original relations.
Example
In relational algebra, the input is a relation (a table from which data is accessed), and the output is also a relation (a temporary table holding the requested data). Relational algebra processes the entire table at once, so there is no need for loops to iterate over rows. You specify the table name, and relational algebra retrieves the data with a single command.
1.Selection (σ): Selects rows that satisfy a given predicate.
2.Projection (π): Selects specific columns from a table.
3.Union (∪): Combines the results of two tables.
4.Set Difference (-): Finds the difference between two tables.
5.Cartesian Product (×): Combines two tables into a single table.
6.Rename (ρ): Renames the output relation.
Unary Operators: Selection, Projection, and Rename are Unary operators because they operate on one relation.
Binary Operators: Union, Set Difference, and Cartesian Product are Binary operators because they operate on two relation.
1.Natural Join (⨝): Combines two tables based on common attributes.
2.Outer Joins: Combines two tables while retaining rows from one or both tables.
⇒Left Outer Join (⟕):
⇒ Right Outer Join (⟖):
⇒Full Outer Join (⟗):
3.Set Intersection (∩): Finds the common elements between two tables.
4.Division (÷): Divides one relation by another.
5.Assignment (←): Assigns the result of a query to a relation.
All the above derived operations are binary operators because they operate on two relations.