SlideShare a Scribd company logo
1 of 17
Table of contents:
Relational Algebra:
 Unary Operation
o Selection
o projection
 Binary Operation
o Union
o Set Difference
o Cartesian Product
Relational Algebra:
Relational Algebra is a procedural language that processes one
or more relations to define another relation without changing
original relation.
1. Selection Operation:
o Acts like a filter on a relation.
o Return only a certain number of tuples.
o Selects the tuple using a condition.
o Resulting relation has the same degree as the original relation.
 Unary Relation:
o Involve only one relation.
Examples: Assume a relation EMP has the following tuples:
Name Office Dept Rank
Ahmed 220 CS lecturer
baber 140 Ecno Assistant
Saleem 160 CS Associate
mirza 500 FIn Associate
σ dept=‘cs’(EMP)
Result:.
Name Office Dept Rank
Ali 400 CS Assistant
Saleem 160 CS Associate
Question: Select only those employees who are in CS department.
2. Projection:
o Limit the attribute returned from the original relation.
o Projection operator is pi π .
o Resulting table has the same number of tuples as the original.
Example: Assume the EMP relation
Name Office Dept Rank
Ahmed 220 CS lecturer
baber 140 Ecno Assistant
Saleem 160 CS Associate
mirza 500 FIn Associate
Question:
Display the names and departments of the all employees working in
CS department:
π name,Dept (σ dept=‘cs’(EMP) )
Result:
Name Dept
Ahmed CS
Saleem CS
o Operations which involve pairs of relations.
o Uses two operations as input and produce a new relation as output.
o Types:
1. Union
2. Set Difference
3. Cartesian Product
 Binary Operations:
o Union operation of two relations combines the tuples of
both relations to produce a third relation.
o Denoted by U.
1.Union:
X Y Z
1 A 10
2 B 20
3 C 30
X Y Z
1 A 10
4 D 40
5 E 50
X Y Z
1 A 10
2 B 20
3 C 30
4 D 40
5 E 50
Table A Table B A UNION B
Example: (A U B)
Two relations A and B are combined together by using union operator.
2. Set Difference
o Works on two relations.
o Produces a third relation that contains the tuples that occur
in the first relation but not in second.
Example: There are two relations A and B.
X Y Z
1 A 10
2 B 20
3 C 30
X Y Z
1 A 10
4 D 40
5 E 50
X Y Z
2 B 20
3 C 30
X Y Z
4 D 40
5 E 50
Table B A - B B - ATable A
3. Cartesian Product :
o Works on two relations.
o Concatenates every tuple in one relation with every tuple second.
o Also called cross product.
o Product is denoted by a × b.
Example:
X Y Z
1 A 10
2 B 20
3 C 30
Table A
X Y Z
1 A 10
4 D 40
5 E 50
X1 Y1 Z1 X2 Y2 Z2
1 A 10 1 A 10
1 A 10 4 D 40
1 A 10 5 E 50
2 B 20 1 A 10
2 B 20 4 D 40
2 B 20 5 E 50
3 C 30 1 A 10
3 C 30 4 D 40
3 C 30 5 A 50
Table B
Table A × B
Presentation

More Related Content

Viewers also liked

Viewers also liked (18)

Ejercicio 8
Ejercicio 8Ejercicio 8
Ejercicio 8
 
Maloclusiónes ortodoncia
Maloclusiónes ortodonciaMaloclusiónes ortodoncia
Maloclusiónes ortodoncia
 
MEDICION EN LA PSICOLOGIA DE LA PERSONALIDAD.
MEDICION EN LA PSICOLOGIA DE LA PERSONALIDAD.MEDICION EN LA PSICOLOGIA DE LA PERSONALIDAD.
MEDICION EN LA PSICOLOGIA DE LA PERSONALIDAD.
 
Walt whitman poetry
Walt whitman poetryWalt whitman poetry
Walt whitman poetry
 
English School Presentation 2017-03-31-soshi
English School Presentation 2017-03-31-soshiEnglish School Presentation 2017-03-31-soshi
English School Presentation 2017-03-31-soshi
 
Chef
ChefChef
Chef
 
Sistema agrícola reparto y de tierras inca
Sistema agrícola reparto y de tierras inca Sistema agrícola reparto y de tierras inca
Sistema agrícola reparto y de tierras inca
 
The infinitiveof purpos
The infinitiveof purposThe infinitiveof purpos
The infinitiveof purpos
 
Ejercicio 9
Ejercicio 9Ejercicio 9
Ejercicio 9
 
Complicaciones post operatorias
Complicaciones post operatoriasComplicaciones post operatorias
Complicaciones post operatorias
 
Ejercicio 7
Ejercicio 7Ejercicio 7
Ejercicio 7
 
3Com JD349A
3Com JD349A3Com JD349A
3Com JD349A
 
3Com 3C89007
3Com 3C890073Com 3C89007
3Com 3C89007
 
Nbr 14565 07 2000
Nbr 14565 07 2000Nbr 14565 07 2000
Nbr 14565 07 2000
 
Government policies – food production – canada
Government policies – food production – canadaGovernment policies – food production – canada
Government policies – food production – canada
 
old data
old dataold data
old data
 
Impact of television and cinema on society
Impact of television and cinema on societyImpact of television and cinema on society
Impact of television and cinema on society
 
4. psicopedagogía 3 al 7 de marzo
4. psicopedagogía  3 al 7 de marzo4. psicopedagogía  3 al 7 de marzo
4. psicopedagogía 3 al 7 de marzo
 

Similar to Presentation

FINAL PAPER FP304 DATABASE SYSTEM
FINAL PAPER FP304 DATABASE SYSTEMFINAL PAPER FP304 DATABASE SYSTEM
FINAL PAPER FP304 DATABASE SYSTEM
Amira Dolce Farhana
 
Exploring Microsoft Office 2010 Volume 1 Excel Chapter 2Testbank.docx
Exploring Microsoft Office 2010 Volume 1 Excel Chapter 2Testbank.docxExploring Microsoft Office 2010 Volume 1 Excel Chapter 2Testbank.docx
Exploring Microsoft Office 2010 Volume 1 Excel Chapter 2Testbank.docx
POLY33
 
4.2 exponential functions and compound interests
4.2 exponential functions and compound interests4.2 exponential functions and compound interests
4.2 exponential functions and compound interests
math260
 
2.2 exponential function and compound interest
2.2 exponential function and compound interest2.2 exponential function and compound interest
2.2 exponential function and compound interest
math123c
 

Similar to Presentation (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
 
FINAL PAPER FP304 DATABASE SYSTEM
FINAL PAPER FP304 DATABASE SYSTEMFINAL PAPER FP304 DATABASE SYSTEM
FINAL PAPER FP304 DATABASE SYSTEM
 
04.formula and fuction
04.formula and fuction04.formula and fuction
04.formula and fuction
 
Boolean variables r010
Boolean variables   r010Boolean variables   r010
Boolean variables r010
 
Operators
OperatorsOperators
Operators
 
Lecture 05-Logic expression and Boolean Algebra.pptx
Lecture 05-Logic expression and Boolean Algebra.pptxLecture 05-Logic expression and Boolean Algebra.pptx
Lecture 05-Logic expression and Boolean Algebra.pptx
 
Programming C Part 02
Programming C Part 02Programming C Part 02
Programming C Part 02
 
Database management concepts
Database management conceptsDatabase management concepts
Database management concepts
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
Database management concept
Database management conceptDatabase management concept
Database management concept
 
Exploring Microsoft Office 2010 Volume 1 Excel Chapter 2Testbank.docx
Exploring Microsoft Office 2010 Volume 1 Excel Chapter 2Testbank.docxExploring Microsoft Office 2010 Volume 1 Excel Chapter 2Testbank.docx
Exploring Microsoft Office 2010 Volume 1 Excel Chapter 2Testbank.docx
 
Gen Math Lesson 1.pptx
Gen Math Lesson 1.pptxGen Math Lesson 1.pptx
Gen Math Lesson 1.pptx
 
Unit 7.2
Unit 7.2Unit 7.2
Unit 7.2
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
202002007.pptx
202002007.pptx202002007.pptx
202002007.pptx
 
Power Rule
Power RulePower Rule
Power Rule
 
4.2 exponential functions and periodic compound interests pina x
4.2 exponential functions and periodic compound interests pina x4.2 exponential functions and periodic compound interests pina x
4.2 exponential functions and periodic compound interests pina x
 
4.2 exponential functions and compound interests
4.2 exponential functions and compound interests4.2 exponential functions and compound interests
4.2 exponential functions and compound interests
 
2.2 exponential function and compound interest
2.2 exponential function and compound interest2.2 exponential function and compound interest
2.2 exponential function and compound interest
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra ppt
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 

Presentation

  • 1.
  • 2.
  • 3. Table of contents: Relational Algebra:  Unary Operation o Selection o projection  Binary Operation o Union o Set Difference o Cartesian Product
  • 4. Relational Algebra: Relational Algebra is a procedural language that processes one or more relations to define another relation without changing original relation.
  • 5. 1. Selection Operation: o Acts like a filter on a relation. o Return only a certain number of tuples. o Selects the tuple using a condition. o Resulting relation has the same degree as the original relation.  Unary Relation: o Involve only one relation.
  • 6. Examples: Assume a relation EMP has the following tuples: Name Office Dept Rank Ahmed 220 CS lecturer baber 140 Ecno Assistant Saleem 160 CS Associate mirza 500 FIn Associate
  • 7. σ dept=‘cs’(EMP) Result:. Name Office Dept Rank Ali 400 CS Assistant Saleem 160 CS Associate Question: Select only those employees who are in CS department.
  • 8. 2. Projection: o Limit the attribute returned from the original relation. o Projection operator is pi π . o Resulting table has the same number of tuples as the original. Example: Assume the EMP relation Name Office Dept Rank Ahmed 220 CS lecturer baber 140 Ecno Assistant Saleem 160 CS Associate mirza 500 FIn Associate
  • 9. Question: Display the names and departments of the all employees working in CS department: π name,Dept (σ dept=‘cs’(EMP) ) Result: Name Dept Ahmed CS Saleem CS
  • 10. o Operations which involve pairs of relations. o Uses two operations as input and produce a new relation as output. o Types: 1. Union 2. Set Difference 3. Cartesian Product  Binary Operations:
  • 11. o Union operation of two relations combines the tuples of both relations to produce a third relation. o Denoted by U. 1.Union:
  • 12. X Y Z 1 A 10 2 B 20 3 C 30 X Y Z 1 A 10 4 D 40 5 E 50 X Y Z 1 A 10 2 B 20 3 C 30 4 D 40 5 E 50 Table A Table B A UNION B Example: (A U B) Two relations A and B are combined together by using union operator.
  • 13. 2. Set Difference o Works on two relations. o Produces a third relation that contains the tuples that occur in the first relation but not in second.
  • 14. Example: There are two relations A and B. X Y Z 1 A 10 2 B 20 3 C 30 X Y Z 1 A 10 4 D 40 5 E 50 X Y Z 2 B 20 3 C 30 X Y Z 4 D 40 5 E 50 Table B A - B B - ATable A
  • 15. 3. Cartesian Product : o Works on two relations. o Concatenates every tuple in one relation with every tuple second. o Also called cross product. o Product is denoted by a × b.
  • 16. Example: X Y Z 1 A 10 2 B 20 3 C 30 Table A X Y Z 1 A 10 4 D 40 5 E 50 X1 Y1 Z1 X2 Y2 Z2 1 A 10 1 A 10 1 A 10 4 D 40 1 A 10 5 E 50 2 B 20 1 A 10 2 B 20 4 D 40 2 B 20 5 E 50 3 C 30 1 A 10 3 C 30 4 D 40 3 C 30 5 A 50 Table B Table A × B