Introduction to RelationalAlgebra
• Relational Algebra is a procedural query
language.
• It uses a set of operations to take one or two
relations as input and produce a new relation
as output.
• Used for querying and manipulating data in
relational databases.
3.
Basic Operations
• 1.Selection (σ): Filters rows based on a
condition.
• 2. Projection (π): Selects specific columns.
• 3. Union ( ): Combines tuples from two
∪
relations.
• 4. Set Difference (−): Returns tuples in one
relation but not in another.
• 5. Cartesian Product (×): Combines all tuples
from two relations.
• 6. Rename (ρ): Renames the output relation.
4.
Advanced Operations
• 1.Join: Combines related tuples from two
relations.
• - Natural Join
• - Theta Join
• - Equi Join
• 2. Division: Used when you need to find tuples
in one relation that are related to all tuples in
another relation.
Applications of RelationalAlgebra
• 1. Query optimization in DBMS.
• 2. Foundation for SQL queries.
• 3. Theoretical basis for relational databases.
• 4. Helps in understanding query processing.
7.
Conclusion
• Relational Algebrais a core component of
relational database systems.
• Understanding it helps in writing efficient
queries and understanding how databases
work internally.