SlideShare a Scribd company logo
1 of 29
RELATIONAL ALGEBRA
AFIF AL MAMUN
RELATIONAL ALGEBRA
Definition: An algebra whose operands are relations or variables that represent
relations.
In database terminology, Relational algebra is a procedural query language.
RELATIONAL ALGEBRA
It consists of:
• SELECTION
• PROJECTION
• DIVISION
• UNION
• INTERSECTION
• PRODUCTS
• NATURAL JOIN
• THETA JOIN
• SET DIFFERENCE
• RENAME
• COMPOSITION etc.
RELATIONAL OPERATORS
SELECTION: σ
PROJECTION: π
DIVISION: ÷
UNION: U
INTERSECTION: ∩
PRODUCTS: x
NATURAL JOIN: ⋈
THETA JOIN: ⋈θ
SET DIFFERENCE: -
RENAME: ρ
SELECTION
Selects tuples from a relation whose attributes meet the selection criteria, which is
normally expressed as a predicate.
Notation − σp(r)
Where σ stands for selection predicate and r stands for relation. p is prepositional
logic formula which may use connectors like and, or, and not. These terms may use
relational operators like − =, ≠, ≥, < , >, ≤.
SELECTION (CONTINUED…)
Example: σrating>8 (S2)
Figure: Sailor Instance Figure: Selection Operation
PROJECTION
It projects column(s) that satisfy a given predicate.
Notation − πCOl1, COl2, …, COLN(r)
Where COL1, COL2 , COLN are attribute names of relation r.
Duplicate rows are automatically eliminated, as relation is a set.
PROJECTION(CONTINUED…)
Example: πsname, rating(S2)
Figure: Sailor Instance Figure: Projection Operation
PROJECTION(CONTINUED…)
Example: πage(S2) [Elimination of Duplication]
Figure: Sailor Instance Figure: Projection Operation
DIVISION
The division is a binary operation that is written as R ÷ S.
Notation − R ÷ S
The result consists of the restrictions of tuples in R to the attribute names unique
to R, i.e., in the header of R but not in the header of S, for which it holds that all their
combinations with tuples in S are present in R.
DIVISION(CONTINUED…)
Example:
=÷
UNION
It performs binary union between two given relations and is defined as −
A ∪ B = { t | t ∈ A or t ∈ B}
Notation − ∪
Figure: A U B
UNION(CONTINUED…)
Example: A U B
U =
INTERSECTION
It performs binary union between two given relations and is defined as −
A ∩ B = { t | t ∈ A and t ∈ B}
Notation − ∩
Figure: A ∩ B
INTERSECTION(CONTINUED…)
Example:
Figure: A ∩ B
∩ =
INTERSECTION(CONTINUED…)
Example:
Figure: A ∩ B
∩ =
PRODUCT
Combines information of two different relations into one.
Notation − r Χ s
Where r and s are relations and their output will be defined as −
r Χ s = { q t | q ∈ r and t ∈ s}
PRODUCT(CONTINUED…)
Example:
Figure: A X B
X =
NATURAL JOIN
Combines information of two different relations into one.
Notation − ⋈
Natural join (⋈) is a binary operator that is written as (R ⋈ S) where R and S are
relations. The result of the natural join is the set of all combinations of tuples in R and
S that are equal on their common attribute names.
NATURAL JOIN(CONTINUED…)
Example:
Figure: Natural Join
THETA JOIN
Theta join combines tuples from different relations provided they satisfy the theta
condition. The join condition is denoted by the symbol θ.
Notation − R1 ⋈θ R2
R1 and R2 are relations having attributes (A1, A2, .., An) and (B1, B2,.. ,Bn) such that
the attributes don’t have anything in common, that is R1 ∩ R2 = Φ.
THETA JOIN(CONTINUED…)
Example:
Figure: Theta Join
SET DIFFERENCE
The result of set difference operation is tuples, which are present in one relation but
are not in the second relation.
Notation − A − B
Finds all the tuples that are present in A but not in B.
SET DIFFERENCE(CONTINUED…)
Example:
Figure: Difference
- =
RENAME
Theta join combines tuples from different relations provided they satisfy the theta
condition. The join condition is denoted by the symbol θ.
Notation − ρ x (A)
Where the result of expression A is saved with name of x.
COMPOSITION
Composition is the type of relational operation where multiple operations are
performed at once.
Example− A=C(m x n)
COMPOSITION(CONTINUED…)
A B C D E
 1
1
1
1
2
2
2
2
 10
10
20
10
10
10
20
10
a
a
b
b
a
a
b
b
 
 
 
 
 
 
 
A B C D E



1
2
2



10
10
20
a
a
b
A B


1
2
m
C D E




10
10
20
10
a
a
b
b
n A=C(m x n) A=C(m x n) [Simplified]
THANK YOU!
REFERENCES
1. https://www.cs.rochester.edu/~nelson/courses/csc_173/relations/algebra.html
2. https://www.tutorialspoint.com/dbms/relational_algebra.htm
3. http://infolab.stanford.edu/~ullman/fcdb/aut07/slides/ra.pdf
4. https://www.slideshare.net/guest20b0b3/relational-algebra-presentation?qid=fea70d5f-1d70-4d6d-88f7-
ca0f6a78d64c&v=&b=&from_search=6
5. https://en.wikipedia.org/wiki/Relational_algebra

More Related Content

What's hot (20)

Relational Algebra,Types of join
Relational Algebra,Types of joinRelational Algebra,Types of join
Relational Algebra,Types of join
 
Types Of Keys in DBMS
Types Of Keys in DBMSTypes Of Keys in DBMS
Types Of Keys in DBMS
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
Operators in java
Operators in javaOperators in java
Operators in java
 
HTML
HTMLHTML
HTML
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
What is an API?
What is an API?What is an API?
What is an API?
 
Data Abstraction
Data AbstractionData Abstraction
Data Abstraction
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra ppt
 
Dtd
DtdDtd
Dtd
 
ER model
ER modelER model
ER model
 
ER to Relational Mapping
ER to Relational MappingER to Relational Mapping
ER to Relational Mapping
 
Join
JoinJoin
Join
 
ER-Model-ER Diagram
ER-Model-ER DiagramER-Model-ER Diagram
ER-Model-ER Diagram
 
Create table
Create tableCreate table
Create table
 
ER model to Relational model mapping
ER model to Relational model mappingER model to Relational model mapping
ER model to Relational model mapping
 
Function
FunctionFunction
Function
 
MatplotLib.pptx
MatplotLib.pptxMatplotLib.pptx
MatplotLib.pptx
 
Er model ppt
Er model pptEr model ppt
Er model ppt
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and Interface
 

Similar to Relational Algebra Introduction

Unit-II DBMS presentation for students.pdf
Unit-II DBMS presentation for students.pdfUnit-II DBMS presentation for students.pdf
Unit-II DBMS presentation for students.pdfajajkhan16
 
Relational algebra
Relational algebraRelational algebra
Relational algebraVENNILAV6
 
Relational algebra-and-relational-calculus
Relational algebra-and-relational-calculusRelational algebra-and-relational-calculus
Relational algebra-and-relational-calculusSalman Vadsarya
 
Relations
RelationsRelations
RelationsGaditek
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model IntroductionNishant Munjal
 
basics of autometa theory for beginner .
basics of autometa theory for beginner .basics of autometa theory for beginner .
basics of autometa theory for beginner .NivaTripathy1
 
Relational algebra operations
Relational algebra operationsRelational algebra operations
Relational algebra operationsSanthiNivas
 
Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)
Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)
Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)Raj vardhan
 
3._Relational_Algebra.pptx:Basics of relation algebra
3._Relational_Algebra.pptx:Basics of relation algebra3._Relational_Algebra.pptx:Basics of relation algebra
3._Relational_Algebra.pptx:Basics of relation algebraZakriyaMalik2
 

Similar to Relational Algebra Introduction (20)

Unit-II DBMS presentation for students.pdf
Unit-II DBMS presentation for students.pdfUnit-II DBMS presentation for students.pdf
Unit-II DBMS presentation for students.pdf
 
Relational Algebra-23-04-2023.pdf
Relational Algebra-23-04-2023.pdfRelational Algebra-23-04-2023.pdf
Relational Algebra-23-04-2023.pdf
 
Ch2
Ch2Ch2
Ch2
 
Sets and relations
Sets and relationsSets and relations
Sets and relations
 
Chapter6
Chapter6Chapter6
Chapter6
 
Relational algebra
Relational algebraRelational algebra
Relational algebra
 
relational algebra
relational algebrarelational algebra
relational algebra
 
Relational algebra-and-relational-calculus
Relational algebra-and-relational-calculusRelational algebra-and-relational-calculus
Relational algebra-and-relational-calculus
 
Relations
RelationsRelations
Relations
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
basics of autometa theory for beginner .
basics of autometa theory for beginner .basics of autometa theory for beginner .
basics of autometa theory for beginner .
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
Ra Revision
Ra RevisionRa Revision
Ra Revision
 
Relations
RelationsRelations
Relations
 
Relational+algebra (1)
Relational+algebra (1)Relational+algebra (1)
Relational+algebra (1)
 
Relational algebra operations
Relational algebra operationsRelational algebra operations
Relational algebra operations
 
Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)
Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)
Relational Algebra Ch6 (Navathe 4th edition)/ Ch7 (Navathe 3rd edition)
 
354 ch6
354 ch6354 ch6
354 ch6
 
3._Relational_Algebra.pptx:Basics of relation algebra
3._Relational_Algebra.pptx:Basics of relation algebra3._Relational_Algebra.pptx:Basics of relation algebra
3._Relational_Algebra.pptx:Basics of relation algebra
 
Lemh101
Lemh101Lemh101
Lemh101
 

More from Md. Afif Al Mamun

More from Md. Afif Al Mamun (10)

Introduction to Big Data
Introduction to Big DataIntroduction to Big Data
Introduction to Big Data
 
Internet of Things(IoT)
Internet of Things(IoT)Internet of Things(IoT)
Internet of Things(IoT)
 
Introduction to Software
Introduction to SoftwareIntroduction to Software
Introduction to Software
 
Parallel Circuits
Parallel CircuitsParallel Circuits
Parallel Circuits
 
Introduction to Cryptography
Introduction to CryptographyIntroduction to Cryptography
Introduction to Cryptography
 
Linked list
Linked listLinked list
Linked list
 
Presentation on pointer.
Presentation on pointer.Presentation on pointer.
Presentation on pointer.
 
Mechanism of a Microwave Oven.
Mechanism of a Microwave Oven.Mechanism of a Microwave Oven.
Mechanism of a Microwave Oven.
 
George Harrison
George HarrisonGeorge Harrison
George Harrison
 
Artificial Intelligence(AI).
Artificial Intelligence(AI).Artificial Intelligence(AI).
Artificial Intelligence(AI).
 

Recently uploaded

APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 

Recently uploaded (20)

DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 

Relational Algebra Introduction