SlideShare a Scribd company logo
The Relational Algebra
Lecture 3
Assistant Lecturer Huda A. Alameen
hudaa.alameen@uokufa.edu.iq
The Relational Algebra:
 Relational algebra is the basic set of operations for the
relational model
 These operations enable a user to specify basic retrieval
requests (or queries)
 The result of an operation is a new relation, which may
have been formed from one or more input relations
The fundamental operations in the
relational algebra:
 Unary operations: are called unary operations, because they operate on
one relation.
▫Select.
▫Project.
 Binary operations: operate on pairs of relations and are, therefore, called
binary operations.
▫Union.
▫Intersection
▫set difference.
▫Cartesian product.
1- The Select Operation
 The select operation selects tuples that satisfy a given
predicate.
 We use the lowercase Greek letter sigma (Ϭ) to denote
selection
 In general, the SELECT operation is denoted by
σ<selection condition>(R)
To select tuples of the instructor relation where the instructor is in the “Physics”
department, we write:
Ϭ dept_name =“Physics” (instructor )
•The Result will be
The Select Operation
2- The Project Operation
The Project Operation
3- The Union Operation
 For a union operation r ∪ s to be valid, these two conditions must be
hold:
 The relations r and s must have the same number of attributes.
 The domains of the ith attribute of r and the ith attribute of s must be
the same, for all i.
4- The Intersection:
 Intersection is denoted by ∩
 The result of this operation, denoted by R ∩ S, is a
relation that includes all tuples that are in both R and S.
 The attribute names in the result will be the same as the
attribute names in R
 The two operand relations R and S must be “type
compatible”
5- The Set-Difference Operation
 The set-difference operation, denoted by (−)
 allows us to find tuples that are in one relation but are
not in another.
 The expression r − s produces a relation containing those
tuples in r but not in s.
6- The Cartesian-Product Operation
 denoted by a cross (×).
 allows us to combine information from any two relations.
 We write the Cartesian product of relations r1 and r2 as r1
× r2.
The Binary Relational Operation: Join
The Binary Relational Operation: Join
Binary Relational Operations: NATURAL
JOIN Operation
Binary Relational Operations: NATURAL
JOIN Operation
Example of NATURAL JOIN operation
Binary Relational Operations: Outer JOIN
Operation
 The outer-join operation is an extension of the join
operation to deal with missing information.
 Some tuples in either or both of the relations being joined
may be lost.
 The outer join operation works in a manner similar to the
natural join operation but preserves those tuples that
would be lost in an join.
 This is done by creating tuples in the result containing null
values.
Binary Relational Operations: Outer JOIN
Operation
 There are three forms of the operation:
1. left outer join, denoted ⟕: takes all tuples in the left relation that did not match with any
tuple in the right relation, pads the tuples with null values for all other attributes from the right
relation, and adds them to the result of the natural join.
2. right outer join, denoted ⟖: is symmetric with the left outer join: It pads tuples from the right
relation that did not match any from the left relation with nulls and adds them to the result of
the natural join.
3. Full outer join ⟗: does both the left and right outer join operations, padding tuples from the
left relation that did not match any from the right relation, as well as tuples from the right
relation that did not match any from the left relation, and adding them to the result of the join.
Relational algebra
Relational algebra
Relational algebra
Relational algebra

More Related Content

What's hot

R operators
R   operatorsR   operators
procedures
proceduresprocedures
procedures
Rajendran
 
Operators
OperatorsOperators
Operator Precedence and Associativity
Operator Precedence and AssociativityOperator Precedence and Associativity
Operator Precedence and Associativity
Nicole Ynne Estabillo
 
Python operators
Python operatorsPython operators
Python operators
nuripatidar
 
Functional forms in regression
Functional forms in regressionFunctional forms in regression
Functional forms in regression
B SWAMINATHAN
 
Selection sort
Selection sortSelection sort
Selection sort
stella D
 
Java Basic Operators
Java Basic OperatorsJava Basic Operators
Java Basic Operators
Shahid Rasheed
 
Relational operators
Relational operatorsRelational operators
operator
operatoroperator
operator
aamirsahito
 
Selection Sort - Vipin Ramola
Selection Sort - Vipin RamolaSelection Sort - Vipin Ramola
Selection Sort - Vipin Ramola
Dipayan Sarkar
 
Reviewer prelims
Reviewer prelimsReviewer prelims
Reviewer prelims
Juan Apolinario Reyes
 
Operators in python
Operators in pythonOperators in python
Operators in python
eShikshak
 
Logical expression and logical operators
Logical expression and logical operatorsLogical expression and logical operators
Logical expression and logical operatorsSuneel Dogra
 
Operators in c
Operators in cOperators in c
Operators in c
Milap Bhanderi
 
Extended relational algebra
Extended relational algebraExtended relational algebra
Extended relational algebra
1Arun_Pandey
 
Reliability problems with solutions
Reliability problems with solutionsReliability problems with solutions
Reliability problems with solutions
SOMNATHGANGULY11
 
Rrelational algebra in dbms overview
Rrelational algebra in dbms overviewRrelational algebra in dbms overview
Rrelational algebra in dbms overview
gourav kottawar
 

What's hot (19)

R operators
R   operatorsR   operators
R operators
 
procedures
proceduresprocedures
procedures
 
Operators
OperatorsOperators
Operators
 
Operator Precedence and Associativity
Operator Precedence and AssociativityOperator Precedence and Associativity
Operator Precedence and Associativity
 
Python operators
Python operatorsPython operators
Python operators
 
Functional forms in regression
Functional forms in regressionFunctional forms in regression
Functional forms in regression
 
Selection sort
Selection sortSelection sort
Selection sort
 
Java Basic Operators
Java Basic OperatorsJava Basic Operators
Java Basic Operators
 
Relational operators
Relational operatorsRelational operators
Relational operators
 
operator
operatoroperator
operator
 
Selection Sort - Vipin Ramola
Selection Sort - Vipin RamolaSelection Sort - Vipin Ramola
Selection Sort - Vipin Ramola
 
Reviewer prelims
Reviewer prelimsReviewer prelims
Reviewer prelims
 
Operators in python
Operators in pythonOperators in python
Operators in python
 
Logical expression and logical operators
Logical expression and logical operatorsLogical expression and logical operators
Logical expression and logical operators
 
Operators in c
Operators in cOperators in c
Operators in c
 
Extended relational algebra
Extended relational algebraExtended relational algebra
Extended relational algebra
 
Reliability problems with solutions
Reliability problems with solutionsReliability problems with solutions
Reliability problems with solutions
 
Rrelational algebra in dbms overview
Rrelational algebra in dbms overviewRrelational algebra in dbms overview
Rrelational algebra in dbms overview
 
Maths itf tushar
Maths itf tusharMaths itf tushar
Maths itf tushar
 

Similar to Relational algebra

5th chapter Relational algebra.pptx
5th chapter Relational algebra.pptx5th chapter Relational algebra.pptx
5th chapter Relational algebra.pptx
kavitha623544
 
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
ajajkhan16
 
Relational algebra (basics)
Relational algebra (basics)Relational algebra (basics)
Relational algebra (basics)
usama nizam
 
E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)Mukund Trivedi
 
E212d9a797dbms chapter3 b.sc2 (1)
E212d9a797dbms chapter3 b.sc2 (1)E212d9a797dbms chapter3 b.sc2 (1)
E212d9a797dbms chapter3 b.sc2 (1)Mukund Trivedi
 
E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2Mukund Trivedi
 
Chapter – 5 Relational Algebra.pdf
Chapter – 5 Relational Algebra.pdfChapter – 5 Relational Algebra.pdf
Chapter – 5 Relational Algebra.pdf
TamiratDejene1
 
Module 2-2.ppt
Module 2-2.pptModule 2-2.ppt
Module 2-2.ppt
Shylaja40
 
Cprogrammingoperator
CprogrammingoperatorCprogrammingoperator
Cprogrammingoperator
teach4uin
 
Database schema architecture.ppt
Database schema architecture.pptDatabase schema architecture.ppt
Database schema architecture.ppt
ImXaib
 
Relational Algebra-23-04-2023.pdf
Relational Algebra-23-04-2023.pdfRelational Algebra-23-04-2023.pdf
Relational Algebra-23-04-2023.pdf
VADAPALLYPRAVEENKUMA1
 
Additional Relational Algebra Operations
Additional Relational Algebra OperationsAdditional Relational Algebra Operations
Additional Relational Algebra Operations
A. S. M. Shafi
 
Chapter6
Chapter6Chapter6
Chapter6
gourab87
 
RelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdfRelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdf
10GUPTASOUMYARAMPRAK
 
Relational operation final
Relational operation finalRelational operation final
Relational operation final
Student
 
Lesson 1 functions as models
Lesson 1 functions as modelsLesson 1 functions as models
Lesson 1 functions as models
AddisonPascua
 
Relation Algebra in MS SQL | Types of relation Alger-bra
Relation Algebra in MS SQL | Types of relation Alger-bra Relation Algebra in MS SQL | Types of relation Alger-bra
Relation Algebra in MS SQL | Types of relation Alger-bra
khalidsheikh24
 
cprogrammingoperator.ppt
cprogrammingoperator.pptcprogrammingoperator.ppt
cprogrammingoperator.ppt
georgejustymirobi1
 

Similar to Relational algebra (20)

5th chapter Relational algebra.pptx
5th chapter Relational algebra.pptx5th chapter Relational algebra.pptx
5th chapter Relational algebra.pptx
 
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 (basics)
Relational algebra (basics)Relational algebra (basics)
Relational algebra (basics)
 
E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)
 
E212d9a797dbms chapter3 b.sc2 (1)
E212d9a797dbms chapter3 b.sc2 (1)E212d9a797dbms chapter3 b.sc2 (1)
E212d9a797dbms chapter3 b.sc2 (1)
 
E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2
 
Chapter – 5 Relational Algebra.pdf
Chapter – 5 Relational Algebra.pdfChapter – 5 Relational Algebra.pdf
Chapter – 5 Relational Algebra.pdf
 
354 ch6
354 ch6354 ch6
354 ch6
 
Module 2-2.ppt
Module 2-2.pptModule 2-2.ppt
Module 2-2.ppt
 
Cprogrammingoperator
CprogrammingoperatorCprogrammingoperator
Cprogrammingoperator
 
Database schema architecture.ppt
Database schema architecture.pptDatabase schema architecture.ppt
Database schema architecture.ppt
 
Relational Algebra-23-04-2023.pdf
Relational Algebra-23-04-2023.pdfRelational Algebra-23-04-2023.pdf
Relational Algebra-23-04-2023.pdf
 
Additional Relational Algebra Operations
Additional Relational Algebra OperationsAdditional Relational Algebra Operations
Additional Relational Algebra Operations
 
Module 2 topic 1 notes
Module 2 topic 1 notesModule 2 topic 1 notes
Module 2 topic 1 notes
 
Chapter6
Chapter6Chapter6
Chapter6
 
RelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdfRelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdf
 
Relational operation final
Relational operation finalRelational operation final
Relational operation final
 
Lesson 1 functions as models
Lesson 1 functions as modelsLesson 1 functions as models
Lesson 1 functions as models
 
Relation Algebra in MS SQL | Types of relation Alger-bra
Relation Algebra in MS SQL | Types of relation Alger-bra Relation Algebra in MS SQL | Types of relation Alger-bra
Relation Algebra in MS SQL | Types of relation Alger-bra
 
cprogrammingoperator.ppt
cprogrammingoperator.pptcprogrammingoperator.ppt
cprogrammingoperator.ppt
 

More from Huda Alameen

Architectural design
Architectural designArchitectural design
Architectural design
Huda Alameen
 
System Modeling
System ModelingSystem Modeling
System Modeling
Huda Alameen
 
Requirements Engineering
Requirements EngineeringRequirements Engineering
Requirements Engineering
Huda Alameen
 
Java Repetiotion Statements
Java Repetiotion StatementsJava Repetiotion Statements
Java Repetiotion Statements
Huda Alameen
 
Java input Scanner
Java input Scanner Java input Scanner
Java input Scanner
Huda Alameen
 
Java Print method
Java  Print methodJava  Print method
Java Print method
Huda Alameen
 
Softweare Engieering
Softweare Engieering Softweare Engieering
Softweare Engieering
Huda Alameen
 
Softweare Engieering
Softweare Engieering Softweare Engieering
Softweare Engieering
Huda Alameen
 
Structured query language(sql)
Structured query language(sql)Structured query language(sql)
Structured query language(sql)
Huda Alameen
 
Sql viwes
Sql viwesSql viwes
Sql viwes
Huda Alameen
 
Normalization
NormalizationNormalization
Normalization
Huda Alameen
 
Lecture one db
Lecture one dbLecture one db
Lecture one db
Huda Alameen
 
Introduction to structured query language
Introduction to structured query languageIntroduction to structured query language
Introduction to structured query language
Huda Alameen
 
Indexing techniques
Indexing techniquesIndexing techniques
Indexing techniques
Huda Alameen
 
Agg fun
Agg funAgg fun
Agg fun
Huda Alameen
 
Se lec1 (1)
Se lec1 (1)Se lec1 (1)
Se lec1 (1)
Huda Alameen
 
Se lec6
Se lec6Se lec6
Se lec6
Huda Alameen
 
Se lec5
Se lec5Se lec5
Se lec5
Huda Alameen
 
Se lec 4
Se lec 4Se lec 4
Se lec 4
Huda Alameen
 
Se lec 3
Se lec 3Se lec 3
Se lec 3
Huda Alameen
 

More from Huda Alameen (20)

Architectural design
Architectural designArchitectural design
Architectural design
 
System Modeling
System ModelingSystem Modeling
System Modeling
 
Requirements Engineering
Requirements EngineeringRequirements Engineering
Requirements Engineering
 
Java Repetiotion Statements
Java Repetiotion StatementsJava Repetiotion Statements
Java Repetiotion Statements
 
Java input Scanner
Java input Scanner Java input Scanner
Java input Scanner
 
Java Print method
Java  Print methodJava  Print method
Java Print method
 
Softweare Engieering
Softweare Engieering Softweare Engieering
Softweare Engieering
 
Softweare Engieering
Softweare Engieering Softweare Engieering
Softweare Engieering
 
Structured query language(sql)
Structured query language(sql)Structured query language(sql)
Structured query language(sql)
 
Sql viwes
Sql viwesSql viwes
Sql viwes
 
Normalization
NormalizationNormalization
Normalization
 
Lecture one db
Lecture one dbLecture one db
Lecture one db
 
Introduction to structured query language
Introduction to structured query languageIntroduction to structured query language
Introduction to structured query language
 
Indexing techniques
Indexing techniquesIndexing techniques
Indexing techniques
 
Agg fun
Agg funAgg fun
Agg fun
 
Se lec1 (1)
Se lec1 (1)Se lec1 (1)
Se lec1 (1)
 
Se lec6
Se lec6Se lec6
Se lec6
 
Se lec5
Se lec5Se lec5
Se lec5
 
Se lec 4
Se lec 4Se lec 4
Se lec 4
 
Se lec 3
Se lec 3Se lec 3
Se lec 3
 

Recently uploaded

Structural Classification Of Protein (SCOP)
Structural Classification Of Protein  (SCOP)Structural Classification Of Protein  (SCOP)
Structural Classification Of Protein (SCOP)
aishnasrivastava
 
Hemoglobin metabolism_pathophysiology.pptx
Hemoglobin metabolism_pathophysiology.pptxHemoglobin metabolism_pathophysiology.pptx
Hemoglobin metabolism_pathophysiology.pptx
muralinath2
 
THE IMPORTANCE OF MARTIAN ATMOSPHERE SAMPLE RETURN.
THE IMPORTANCE OF MARTIAN ATMOSPHERE SAMPLE RETURN.THE IMPORTANCE OF MARTIAN ATMOSPHERE SAMPLE RETURN.
THE IMPORTANCE OF MARTIAN ATMOSPHERE SAMPLE RETURN.
Sérgio Sacani
 
erythropoiesis-I_mechanism& clinical significance.pptx
erythropoiesis-I_mechanism& clinical significance.pptxerythropoiesis-I_mechanism& clinical significance.pptx
erythropoiesis-I_mechanism& clinical significance.pptx
muralinath2
 
Lateral Ventricles.pdf very easy good diagrams comprehensive
Lateral Ventricles.pdf very easy good diagrams comprehensiveLateral Ventricles.pdf very easy good diagrams comprehensive
Lateral Ventricles.pdf very easy good diagrams comprehensive
silvermistyshot
 
RNA INTERFERENCE: UNRAVELING GENETIC SILENCING
RNA INTERFERENCE: UNRAVELING GENETIC SILENCINGRNA INTERFERENCE: UNRAVELING GENETIC SILENCING
RNA INTERFERENCE: UNRAVELING GENETIC SILENCING
AADYARAJPANDEY1
 
The ASGCT Annual Meeting was packed with exciting progress in the field advan...
The ASGCT Annual Meeting was packed with exciting progress in the field advan...The ASGCT Annual Meeting was packed with exciting progress in the field advan...
The ASGCT Annual Meeting was packed with exciting progress in the field advan...
Health Advances
 
plant biotechnology Lecture note ppt.pptx
plant biotechnology Lecture note ppt.pptxplant biotechnology Lecture note ppt.pptx
plant biotechnology Lecture note ppt.pptx
yusufzako14
 
Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
muralinath2
 
Richard's aventures in two entangled wonderlands
Richard's aventures in two entangled wonderlandsRichard's aventures in two entangled wonderlands
Richard's aventures in two entangled wonderlands
Richard Gill
 
NuGOweek 2024 Ghent - programme - final version
NuGOweek 2024 Ghent - programme - final versionNuGOweek 2024 Ghent - programme - final version
NuGOweek 2024 Ghent - programme - final version
pablovgd
 
Anemia_ different types_causes_ conditions
Anemia_ different types_causes_ conditionsAnemia_ different types_causes_ conditions
Anemia_ different types_causes_ conditions
muralinath2
 
(May 29th, 2024) Advancements in Intravital Microscopy- Insights for Preclini...
(May 29th, 2024) Advancements in Intravital Microscopy- Insights for Preclini...(May 29th, 2024) Advancements in Intravital Microscopy- Insights for Preclini...
(May 29th, 2024) Advancements in Intravital Microscopy- Insights for Preclini...
Scintica Instrumentation
 
Hemostasis_importance& clinical significance.pptx
Hemostasis_importance& clinical significance.pptxHemostasis_importance& clinical significance.pptx
Hemostasis_importance& clinical significance.pptx
muralinath2
 
filosofia boliviana introducción jsjdjd.pptx
filosofia boliviana introducción jsjdjd.pptxfilosofia boliviana introducción jsjdjd.pptx
filosofia boliviana introducción jsjdjd.pptx
IvanMallco1
 
Nutraceutical market, scope and growth: Herbal drug technology
Nutraceutical market, scope and growth: Herbal drug technologyNutraceutical market, scope and growth: Herbal drug technology
Nutraceutical market, scope and growth: Herbal drug technology
Lokesh Patil
 
In silico drugs analogue design: novobiocin analogues.pptx
In silico drugs analogue design: novobiocin analogues.pptxIn silico drugs analogue design: novobiocin analogues.pptx
In silico drugs analogue design: novobiocin analogues.pptx
AlaminAfendy1
 
Penicillin...........................pptx
Penicillin...........................pptxPenicillin...........................pptx
Penicillin...........................pptx
Cherry
 
Predicting property prices with machine learning algorithms.pdf
Predicting property prices with machine learning algorithms.pdfPredicting property prices with machine learning algorithms.pdf
Predicting property prices with machine learning algorithms.pdf
binhminhvu04
 
Multi-source connectivity as the driver of solar wind variability in the heli...
Multi-source connectivity as the driver of solar wind variability in the heli...Multi-source connectivity as the driver of solar wind variability in the heli...
Multi-source connectivity as the driver of solar wind variability in the heli...
Sérgio Sacani
 

Recently uploaded (20)

Structural Classification Of Protein (SCOP)
Structural Classification Of Protein  (SCOP)Structural Classification Of Protein  (SCOP)
Structural Classification Of Protein (SCOP)
 
Hemoglobin metabolism_pathophysiology.pptx
Hemoglobin metabolism_pathophysiology.pptxHemoglobin metabolism_pathophysiology.pptx
Hemoglobin metabolism_pathophysiology.pptx
 
THE IMPORTANCE OF MARTIAN ATMOSPHERE SAMPLE RETURN.
THE IMPORTANCE OF MARTIAN ATMOSPHERE SAMPLE RETURN.THE IMPORTANCE OF MARTIAN ATMOSPHERE SAMPLE RETURN.
THE IMPORTANCE OF MARTIAN ATMOSPHERE SAMPLE RETURN.
 
erythropoiesis-I_mechanism& clinical significance.pptx
erythropoiesis-I_mechanism& clinical significance.pptxerythropoiesis-I_mechanism& clinical significance.pptx
erythropoiesis-I_mechanism& clinical significance.pptx
 
Lateral Ventricles.pdf very easy good diagrams comprehensive
Lateral Ventricles.pdf very easy good diagrams comprehensiveLateral Ventricles.pdf very easy good diagrams comprehensive
Lateral Ventricles.pdf very easy good diagrams comprehensive
 
RNA INTERFERENCE: UNRAVELING GENETIC SILENCING
RNA INTERFERENCE: UNRAVELING GENETIC SILENCINGRNA INTERFERENCE: UNRAVELING GENETIC SILENCING
RNA INTERFERENCE: UNRAVELING GENETIC SILENCING
 
The ASGCT Annual Meeting was packed with exciting progress in the field advan...
The ASGCT Annual Meeting was packed with exciting progress in the field advan...The ASGCT Annual Meeting was packed with exciting progress in the field advan...
The ASGCT Annual Meeting was packed with exciting progress in the field advan...
 
plant biotechnology Lecture note ppt.pptx
plant biotechnology Lecture note ppt.pptxplant biotechnology Lecture note ppt.pptx
plant biotechnology Lecture note ppt.pptx
 
Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
Circulatory system_ Laplace law. Ohms law.reynaults law,baro-chemo-receptors-...
 
Richard's aventures in two entangled wonderlands
Richard's aventures in two entangled wonderlandsRichard's aventures in two entangled wonderlands
Richard's aventures in two entangled wonderlands
 
NuGOweek 2024 Ghent - programme - final version
NuGOweek 2024 Ghent - programme - final versionNuGOweek 2024 Ghent - programme - final version
NuGOweek 2024 Ghent - programme - final version
 
Anemia_ different types_causes_ conditions
Anemia_ different types_causes_ conditionsAnemia_ different types_causes_ conditions
Anemia_ different types_causes_ conditions
 
(May 29th, 2024) Advancements in Intravital Microscopy- Insights for Preclini...
(May 29th, 2024) Advancements in Intravital Microscopy- Insights for Preclini...(May 29th, 2024) Advancements in Intravital Microscopy- Insights for Preclini...
(May 29th, 2024) Advancements in Intravital Microscopy- Insights for Preclini...
 
Hemostasis_importance& clinical significance.pptx
Hemostasis_importance& clinical significance.pptxHemostasis_importance& clinical significance.pptx
Hemostasis_importance& clinical significance.pptx
 
filosofia boliviana introducción jsjdjd.pptx
filosofia boliviana introducción jsjdjd.pptxfilosofia boliviana introducción jsjdjd.pptx
filosofia boliviana introducción jsjdjd.pptx
 
Nutraceutical market, scope and growth: Herbal drug technology
Nutraceutical market, scope and growth: Herbal drug technologyNutraceutical market, scope and growth: Herbal drug technology
Nutraceutical market, scope and growth: Herbal drug technology
 
In silico drugs analogue design: novobiocin analogues.pptx
In silico drugs analogue design: novobiocin analogues.pptxIn silico drugs analogue design: novobiocin analogues.pptx
In silico drugs analogue design: novobiocin analogues.pptx
 
Penicillin...........................pptx
Penicillin...........................pptxPenicillin...........................pptx
Penicillin...........................pptx
 
Predicting property prices with machine learning algorithms.pdf
Predicting property prices with machine learning algorithms.pdfPredicting property prices with machine learning algorithms.pdf
Predicting property prices with machine learning algorithms.pdf
 
Multi-source connectivity as the driver of solar wind variability in the heli...
Multi-source connectivity as the driver of solar wind variability in the heli...Multi-source connectivity as the driver of solar wind variability in the heli...
Multi-source connectivity as the driver of solar wind variability in the heli...
 

Relational algebra

  • 1. The Relational Algebra Lecture 3 Assistant Lecturer Huda A. Alameen hudaa.alameen@uokufa.edu.iq
  • 2. The Relational Algebra:  Relational algebra is the basic set of operations for the relational model  These operations enable a user to specify basic retrieval requests (or queries)  The result of an operation is a new relation, which may have been formed from one or more input relations
  • 3. The fundamental operations in the relational algebra:  Unary operations: are called unary operations, because they operate on one relation. ▫Select. ▫Project.  Binary operations: operate on pairs of relations and are, therefore, called binary operations. ▫Union. ▫Intersection ▫set difference. ▫Cartesian product.
  • 4. 1- The Select Operation  The select operation selects tuples that satisfy a given predicate.  We use the lowercase Greek letter sigma (Ϭ) to denote selection  In general, the SELECT operation is denoted by σ<selection condition>(R)
  • 5. To select tuples of the instructor relation where the instructor is in the “Physics” department, we write: Ϭ dept_name =“Physics” (instructor ) •The Result will be
  • 7. 2- The Project Operation
  • 9. 3- The Union Operation  For a union operation r ∪ s to be valid, these two conditions must be hold:  The relations r and s must have the same number of attributes.  The domains of the ith attribute of r and the ith attribute of s must be the same, for all i.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14. 4- The Intersection:  Intersection is denoted by ∩  The result of this operation, denoted by R ∩ S, is a relation that includes all tuples that are in both R and S.  The attribute names in the result will be the same as the attribute names in R  The two operand relations R and S must be “type compatible”
  • 15. 5- The Set-Difference Operation  The set-difference operation, denoted by (−)  allows us to find tuples that are in one relation but are not in another.  The expression r − s produces a relation containing those tuples in r but not in s.
  • 16.
  • 17. 6- The Cartesian-Product Operation  denoted by a cross (×).  allows us to combine information from any two relations.  We write the Cartesian product of relations r1 and r2 as r1 × r2.
  • 18.
  • 19. The Binary Relational Operation: Join
  • 20. The Binary Relational Operation: Join
  • 21.
  • 22. Binary Relational Operations: NATURAL JOIN Operation
  • 23. Binary Relational Operations: NATURAL JOIN Operation
  • 24. Example of NATURAL JOIN operation
  • 25. Binary Relational Operations: Outer JOIN Operation  The outer-join operation is an extension of the join operation to deal with missing information.  Some tuples in either or both of the relations being joined may be lost.  The outer join operation works in a manner similar to the natural join operation but preserves those tuples that would be lost in an join.  This is done by creating tuples in the result containing null values.
  • 26. Binary Relational Operations: Outer JOIN Operation  There are three forms of the operation: 1. left outer join, denoted ⟕: takes all tuples in the left relation that did not match with any tuple in the right relation, pads the tuples with null values for all other attributes from the right relation, and adds them to the result of the natural join. 2. right outer join, denoted ⟖: is symmetric with the left outer join: It pads tuples from the right relation that did not match any from the left relation with nulls and adds them to the result of the natural join. 3. Full outer join ⟗: does both the left and right outer join operations, padding tuples from the left relation that did not match any from the right relation, as well as tuples from the right relation that did not match any from the left relation, and adding them to the result of the join.