SlideShare a Scribd company logo
2. Relational Algebra
Definition:
The basic set of operations for the relational model. And a user
enable to specify basic retrieval requests.
☞ The algebra operations produce new relations, which can be
further manipulated using operations of the same algebra.
☞ A sequence forms a relational algebra expression
☞ Has a procedural paradigm: you need to tell what/how to
construct the result
2. Relational Algebra
Basic Relational Operation:
◆ Unary operations
Select: σ.
Project: or π.
The rename operator: ρ.
◆ Binary operations
Set operations:
Union:
Intersection:
Difference: –
Cartesian product
Join operations:
2. Relational Algebra
◆ Unary operations
Select Operation:
Used to select a subset of the tuples from a relation that satisfy a
selection condition. It is a filter that keeps only those tuples that
satisfy a qualifying condition.
Example
To select the employee tuples whose department number is four or those
whose salary is greater than $30,000 the following notation is used:
Σdno = 4 (employee)
Σsalary > 30,000 (employee)
In general, the select operation is denoted by σ <selection condition>(r)
where the symbol σ (sigma) is used to denote the select operator, and the
selection condition is a boolean expression specified on the attributes of
relation r.
2. Relational Algebra
Rename Operation:
To apply several relational algebra operations one after the other.
Relational algebra expression by nesting the operations, or
apply one operation at a time and create intermediate result
relations. In the latter case, we must give names to the relations
that hold the intermediate results.

Example
To retrieve the first name, last name, and salary of all employees who
work in department number 5, we must apply a select and a project
operation. We can write a single relational algebra expression as follows:
Πfname, lname, salary(σ dno=5(employee))
Or explicitly show the sequence of operations, giving a name to each
Intermediate relation:
Dep5_emps ← σ dno=5(employee)
Result ← π fname, lname, salary (dep5_emps)
2. Relational Algebra
◆ Binary Relational Operations
▪ Relational Algebra Operations from Set theory
Union Operation:
Denoted by r
s, is a relation that includes all tuples that are
either in r or in s or in both r and s.
Example
To retrieve the social security numbers of all employees who either work
in department 5 or directly supervise an employee who works in
department 5, we can use the union operation as follows:
Dep5_emps ← σdno=5 (employee)
Result1 ← π ssn(dep5_emps)
Result2(ssn) ← π superssn(dep5_emps)
Result ← result1 result2
The union operation produces the tuples that are in either result1 or
result2 or both. The two operands must be “type compatible”.
2. Relational Algebra

Student

instructor.
2. Relational Algebra
Join Operation:
• The sequence of Cartesian product followed by select is used
quite commonly to identify and select related tuples from two
relations, a special operation, called join. It is denoted by a
.
• This operation is very important for any relational database with
more than a single relation, because it allows us to process
relationships among relations.
• The general form of a join operation on two relations
r(a1, a2, . . ., an) and s(b1, b2, . . ., bm) is:
R

<join condition>s

Where r and s can be any relations that result from general
relational algebra expressions.
2. Relational Algebra
Join Operation:
Example:
Suppose that we want to retrieve the name of the manager of each
department. To get the manager’s name, we need to combine each
department tuple with the employee tuple whose ssn value matches the
mgrssn value in the department tuple.

We do this by using the join
Dept_mgr ← department

operation.
mgrssn=ssn(mployee).

More Related Content

PPT
PPTX
PPTX
Operator Precedence and Associativity
PPTX
Operators and Expressions
PPTX
Operators and expressions in C++
PPTX
Operator.ppt
PPTX
Variable, constant, operators and control statement
PPTX
Operators in c++
Operator Precedence and Associativity
Operators and Expressions
Operators and expressions in C++
Operator.ppt
Variable, constant, operators and control statement
Operators in c++

What's hot (18)

PPTX
Python operators
PDF
Operators in python
PPTX
DOCX
Data types and operators in vb
PDF
Chapter 5 - Operators in C++
PDF
Relational algebra
PPTX
Operators and expressions
PPTX
Operators and Expressions in Java
PPT
Types of operators in C
PPT
Operation and expression in c++
PPT
CBSE Class XI :- Operators in C++
PPT
Operator & Expression in c++
PPTX
Operators in Python
PPTX
Operators , Functions and Options in VB.NET
PPT
Operators and Expressions in C++
ODP
operators in c++
PPTX
Operators and Expression
PPT
Expressions in c++
Python operators
Operators in python
Data types and operators in vb
Chapter 5 - Operators in C++
Relational algebra
Operators and expressions
Operators and Expressions in Java
Types of operators in C
Operation and expression in c++
CBSE Class XI :- Operators in C++
Operator & Expression in c++
Operators in Python
Operators , Functions and Options in VB.NET
Operators and Expressions in C++
operators in c++
Operators and Expression
Expressions in c++
Ad

Similar to 2 r algebra (20)

PPT
Relational-algebra in Data base management ppts
PPT
Module 2-2.ppt
PDF
DBMS Module 2.2.pdf......................
PPTX
Relational Algebra.pptx for Module four
PPTX
Query and optimizing operating system.pptx
PDF
ppt8 Relational algebra and calculus.pptx.pdf
PPTX
3._Relational_Algebra.pptx:Basics of relation algebra
PPTX
Relational operation final
PPTX
Relation Algebra in MS SQL | Types of relation Alger-bra
PDF
5 the relational algebra and calculus
PPT
DOCX
Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)
PPT
Relational algebra operations
PPT
Database systemhe Relational Alge. goodbra.
PPTX
Relational Algebra in DBMS 2025 power point
PPTX
Chapter-6 Relational Algebra
PPT
relational algebra IN DATABASE MANAGEMENT SYSTEM COURSE FOR 4TH SEM VTU
PDF
RelationalAlgebra-RelationalCalculus-SQL.pdf
PDF
Relational Algebra.pptx (1)_________.pdf
PPT
RELATIONAL ALGEBRA in the Database Management Systems
Relational-algebra in Data base management ppts
Module 2-2.ppt
DBMS Module 2.2.pdf......................
Relational Algebra.pptx for Module four
Query and optimizing operating system.pptx
ppt8 Relational algebra and calculus.pptx.pdf
3._Relational_Algebra.pptx:Basics of relation algebra
Relational operation final
Relation Algebra in MS SQL | Types of relation Alger-bra
5 the relational algebra and calculus
Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)
Relational algebra operations
Database systemhe Relational Alge. goodbra.
Relational Algebra in DBMS 2025 power point
Chapter-6 Relational Algebra
relational algebra IN DATABASE MANAGEMENT SYSTEM COURSE FOR 4TH SEM VTU
RelationalAlgebra-RelationalCalculus-SQL.pdf
Relational Algebra.pptx (1)_________.pdf
RELATIONAL ALGEBRA in the Database Management Systems
Ad

More from Mr Patrick NIYISHAKA (20)

PPTX
PPTX
2 ddb architecture
PPTX
2 countermeasures
PPTX
2 countermeasures
PPTX
PPTX
1 db security
PPTX
PPTX
PPTX
2 con control
PPTX
PPTX
1 basic concepts
PPTX
PPTX
3 transaction
PPTX
PPTX
1 query processing
PPTX
1 query processing
PPTX
2 optimization
PPTX
2 ddb architecture
2 countermeasures
2 countermeasures
1 db security
2 con control
1 basic concepts
3 transaction
1 query processing
1 query processing
2 optimization

Recently uploaded (20)

PDF
Zenith AI: Advanced Artificial Intelligence
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Web App vs Mobile App What Should You Build First.pdf
PPTX
Tartificialntelligence_presentation.pptx
PDF
STKI Israel Market Study 2025 version august
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
observCloud-Native Containerability and monitoring.pptx
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
Developing a website for English-speaking practice to English as a foreign la...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Hindi spoken digit analysis for native and non-native speakers
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Zenith AI: Advanced Artificial Intelligence
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Univ-Connecticut-ChatGPT-Presentaion.pdf
NewMind AI Weekly Chronicles – August ’25 Week III
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Web App vs Mobile App What Should You Build First.pdf
Tartificialntelligence_presentation.pptx
STKI Israel Market Study 2025 version august
NewMind AI Weekly Chronicles - August'25-Week II
observCloud-Native Containerability and monitoring.pptx
Final SEM Unit 1 for mit wpu at pune .pptx
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Developing a website for English-speaking practice to English as a foreign la...
Programs and apps: productivity, graphics, security and other tools
Assigned Numbers - 2025 - Bluetooth® Document
Hindi spoken digit analysis for native and non-native speakers
OMC Textile Division Presentation 2021.pptx
A novel scalable deep ensemble learning framework for big data classification...
1 - Historical Antecedents, Social Consideration.pdf
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game

2 r algebra

  • 1. 2. Relational Algebra Definition: The basic set of operations for the relational model. And a user enable to specify basic retrieval requests. ☞ The algebra operations produce new relations, which can be further manipulated using operations of the same algebra. ☞ A sequence forms a relational algebra expression ☞ Has a procedural paradigm: you need to tell what/how to construct the result
  • 2. 2. Relational Algebra Basic Relational Operation: ◆ Unary operations Select: σ. Project: or π. The rename operator: ρ. ◆ Binary operations Set operations: Union: Intersection: Difference: – Cartesian product Join operations:
  • 3. 2. Relational Algebra ◆ Unary operations Select Operation: Used to select a subset of the tuples from a relation that satisfy a selection condition. It is a filter that keeps only those tuples that satisfy a qualifying condition. Example To select the employee tuples whose department number is four or those whose salary is greater than $30,000 the following notation is used: Σdno = 4 (employee) Σsalary > 30,000 (employee) In general, the select operation is denoted by σ <selection condition>(r) where the symbol σ (sigma) is used to denote the select operator, and the selection condition is a boolean expression specified on the attributes of relation r.
  • 4. 2. Relational Algebra Rename Operation: To apply several relational algebra operations one after the other. Relational algebra expression by nesting the operations, or apply one operation at a time and create intermediate result relations. In the latter case, we must give names to the relations that hold the intermediate results. Example To retrieve the first name, last name, and salary of all employees who work in department number 5, we must apply a select and a project operation. We can write a single relational algebra expression as follows: Πfname, lname, salary(σ dno=5(employee)) Or explicitly show the sequence of operations, giving a name to each Intermediate relation: Dep5_emps ← σ dno=5(employee) Result ← π fname, lname, salary (dep5_emps)
  • 5. 2. Relational Algebra ◆ Binary Relational Operations ▪ Relational Algebra Operations from Set theory Union Operation: Denoted by r s, is a relation that includes all tuples that are either in r or in s or in both r and s. Example To retrieve the social security numbers of all employees who either work in department 5 or directly supervise an employee who works in department 5, we can use the union operation as follows: Dep5_emps ← σdno=5 (employee) Result1 ← π ssn(dep5_emps) Result2(ssn) ← π superssn(dep5_emps) Result ← result1 result2 The union operation produces the tuples that are in either result1 or result2 or both. The two operands must be “type compatible”.
  • 7. 2. Relational Algebra Join Operation: • The sequence of Cartesian product followed by select is used quite commonly to identify and select related tuples from two relations, a special operation, called join. It is denoted by a . • This operation is very important for any relational database with more than a single relation, because it allows us to process relationships among relations. • The general form of a join operation on two relations r(a1, a2, . . ., an) and s(b1, b2, . . ., bm) is: R <join condition>s Where r and s can be any relations that result from general relational algebra expressions.
  • 8. 2. Relational Algebra Join Operation: Example: Suppose that we want to retrieve the name of the manager of each department. To get the manager’s name, we need to combine each department tuple with the employee tuple whose ssn value matches the mgrssn value in the department tuple. We do this by using the join Dept_mgr ← department operation. mgrssn=ssn(mployee).