Relational Algebra
An Overview of Relational Database
Operations
Introduction to Relational Algebra
• 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.
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.
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.
Example Queries
• 1. σ(Salary > 50000)(Employees)
• 2. π(Name, Department)(Employees)
• 3. Employees Managers
∪
• 4. Employees − RetiredEmployees
• 5. Employees × Departments
Applications of Relational Algebra
• 1. Query optimization in DBMS.
• 2. Foundation for SQL queries.
• 3. Theoretical basis for relational databases.
• 4. Helps in understanding query processing.
Conclusion
• Relational Algebra is a core component of
relational database systems.
• Understanding it helps in writing efficient
queries and understanding how databases
work internally.

Relational_Algebra_Presentationnnss.pptx

  • 1.
    Relational Algebra An Overviewof Relational Database Operations
  • 2.
    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.
  • 5.
    Example Queries • 1.σ(Salary > 50000)(Employees) • 2. π(Name, Department)(Employees) • 3. Employees Managers ∪ • 4. Employees − RetiredEmployees • 5. Employees × Departments
  • 6.
    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.