SlideShare une entreprise Scribd logo
1  sur  25
Imran Ali
Imran.ali@kiu.edu.pk
Lecture overview
 Five Basic Operators of Relational
Algebra:
 Select
 Project
 Union
 Intersection
 Cartesian product
6) Formulating queries
Relational Algebra
 The relational algebra is a procedural
query language
 It consists of a set of operations that
take one or two relations as input and
produce a new relation as their result
 There are five basic operations of
relational algebra.
Unary Operations
 These are those operations, which
involve only one relation or table
 These are:
 Select
 Project
Binary Operations
 These are those operations, which involve
pairs of relations and are, therefore called
binary operations
 The input for these operations is two
relations and they produce a new relation
without changing the original relations
 These operations are:
 Union
 Set difference
 Cartesian product
Select Operation
 The select operation is performed to
select certain rows or tuples of a table,
so it performs its action on the table
horizontally
 The tuples are selected through this
operation using a predicate or condition
 This command works on a single table
and takes rows that meet a specified
condition, copying them into a new table
 Denoted by lower Greek letter sigma (σ)
Example
Other operators
 In selection operation the comparison
operators like <, >, =, <=, >=, <> can be
used in the predicate
 Similarly, we can also combine several
simple predicates into a larger predicate
using the connectives and (^ ) and or
(˅).
Project Operation
 The Select operation works horizontally
on the table on the other hand the
Project operator operates on a single
table vertically
 It produces a vertical subset of the table,
extracting the values of specified
columns, eliminating duplicates, and
placing the values in a new table
Project Operation
 It is unary operation that returns its
argument relation, with certain attributes
left out
 Since relation is a set any duplicate
rows are eliminated
 Projection is denoted by a Greek letter
(Π )
 While using this operator all the rows of
selected attributes of a relation are part
of new relation
Example
Composition of relational
operators
 The relational operators like select and
project can also be used in nested forms
iteratively
 As the result of an operation is a relation
so this result can be used as an input for
other operation
 Order is very important
Example
Binary Operations
 These are those operations, which involve
pairs of relations and are, therefore called
binary operations
 The input for these operations is two
relations and they produce a new relation
without changing the original relations
 These operations are:
 Union
 Set difference
 Cartesian product
Union Operations
 The first requirement for union operator is
that both the relations should be union
compatible
 It means that relations must meet the
following two conditions:
 Both the relations should be of same degree,
which means that the number of attributes in
both relations should be exactly same
 The domains of corresponding attributes in both
the relations should be same.
Union Operation
 It is denoted by U
 If R and S are two relations, which are
union compatible, if we take union of these
two relations then the resulting relation
would be the set of tuples either in R or S
or both
 Since it is set so there are no duplicate
tuples
 The union operator is commutative which
means:
R U S = S U R
Example
Intersection Operation
 The intersection operation also has the
requirement that both the relations should
be union compatible i.e they are of same
degree and same domains. It is
represented by
 If R and S are two relations and we take
intersection of these two relations then the
resulting relation would be the set of tuples,
which are in both R and S
 Just like union intersection is also
commutative.
R S = S R
Example
Set Difference Operation
 If R and S are two relations which are
union compatible then difference of
these two relations will be set of tuples
that appear in R but do not appear in S.
It is denoted by (-)
Example
Cartesian Product
 The Cartesian product needs not to be
union compatible
 It means they can be of different degree
 It is denoted by X
 Suppose there is a relation R and S
 The Cartesian product will be:
R X S
It is also called cross product
Example
Lab Activity-10
 Hide columns
 Create relationships
Next Lecture
 Relational Algebra 2 (Joins)

Contenu connexe

Tendances

All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbmsNaresh Kumar
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLEVraj Patel
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Oum Saokosal
 
7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMSkoolkampus
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational modelChirag vasava
 
Enhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) ModelingEnhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) Modelingsontumax
 
Relational Algebra & Calculus
Relational Algebra & CalculusRelational Algebra & Calculus
Relational Algebra & CalculusAbdullah Khosa
 
Functional dependancy
Functional dependancyFunctional dependancy
Functional dependancyVisakh V
 
3. Relational Models in DBMS
3. Relational Models in DBMS3. Relational Models in DBMS
3. Relational Models in DBMSkoolkampus
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalizationUniversity of Potsdam
 
Er & eer to relational mapping
Er & eer to relational mappingEr & eer to relational mapping
Er & eer to relational mappingsaurabhshertukde
 
Normalization in a Database
Normalization in a DatabaseNormalization in a Database
Normalization in a DatabaseBishrul Haq
 
database language ppt.pptx
database language ppt.pptxdatabase language ppt.pptx
database language ppt.pptxAnusha sivakumar
 

Tendances (20)

Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbms
 
relational algebra
relational algebrarelational algebra
relational algebra
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)
 
7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMS
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
Joins in SQL
Joins in SQLJoins in SQL
Joins in SQL
 
Enhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) ModelingEnhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) Modeling
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
Relational Algebra & Calculus
Relational Algebra & CalculusRelational Algebra & Calculus
Relational Algebra & Calculus
 
Functional dependancy
Functional dependancyFunctional dependancy
Functional dependancy
 
3. Relational Models in DBMS
3. Relational Models in DBMS3. Relational Models in DBMS
3. Relational Models in DBMS
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalization
 
Mysql joins
Mysql joinsMysql joins
Mysql joins
 
Er & eer to relational mapping
Er & eer to relational mappingEr & eer to relational mapping
Er & eer to relational mapping
 
Normalization in a Database
Normalization in a DatabaseNormalization in a Database
Normalization in a Database
 
Dbms normalization
Dbms normalizationDbms normalization
Dbms normalization
 
database language ppt.pptx
database language ppt.pptxdatabase language ppt.pptx
database language ppt.pptx
 

Similaire à Relational algebra (basics)

relational algebra-(basics)
 relational algebra-(basics) relational algebra-(basics)
relational algebra-(basics)Nilt1234
 
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
 
E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2Mukund Trivedi
 
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
 
Module 2-2.ppt
Module 2-2.pptModule 2-2.ppt
Module 2-2.pptShylaja40
 
5th chapter Relational algebra.pptx
5th chapter Relational algebra.pptx5th chapter Relational algebra.pptx
5th chapter Relational algebra.pptxkavitha623544
 
Relational algebra
Relational algebraRelational algebra
Relational algebraHuda Alameen
 
Chapter – 5 Relational Algebra.pdf
Chapter – 5 Relational Algebra.pdfChapter – 5 Relational Algebra.pdf
Chapter – 5 Relational Algebra.pdfTamiratDejene1
 
relational algebra (joins)
relational algebra (joins)relational algebra (joins)
relational algebra (joins)Nilt1234
 
Lesson 1 functions as models
Lesson 1 functions as modelsLesson 1 functions as models
Lesson 1 functions as modelsAddisonPascua
 
Relational algebra calculus
Relational algebra  calculusRelational algebra  calculus
Relational algebra calculusVaibhav Kathuria
 
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
 
RelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdfRelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdf10GUPTASOUMYARAMPRAK
 
Relational algebra
Relational algebraRelational algebra
Relational algebraVENNILAV6
 
Relational Algebra Operations
Relational Algebra OperationsRelational Algebra Operations
Relational Algebra OperationsShefa Idrees
 
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
 

Similaire à Relational algebra (basics) (20)

relational algebra-(basics)
 relational algebra-(basics) relational algebra-(basics)
relational algebra-(basics)
 
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
 
E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2
 
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)
 
Module 2-2.ppt
Module 2-2.pptModule 2-2.ppt
Module 2-2.ppt
 
Relational Algebra-23-04-2023.pdf
Relational Algebra-23-04-2023.pdfRelational Algebra-23-04-2023.pdf
Relational Algebra-23-04-2023.pdf
 
5th chapter Relational algebra.pptx
5th chapter Relational algebra.pptx5th chapter Relational algebra.pptx
5th chapter Relational algebra.pptx
 
Relational algebra
Relational algebraRelational algebra
Relational algebra
 
Chapter – 5 Relational Algebra.pdf
Chapter – 5 Relational Algebra.pdfChapter – 5 Relational Algebra.pdf
Chapter – 5 Relational Algebra.pdf
 
relational algebra (joins)
relational algebra (joins)relational algebra (joins)
relational algebra (joins)
 
354 ch6
354 ch6354 ch6
354 ch6
 
Lesson 1 functions as models
Lesson 1 functions as modelsLesson 1 functions as models
Lesson 1 functions as models
 
Relational algebra calculus
Relational algebra  calculusRelational algebra  calculus
Relational algebra calculus
 
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)
 
Chapter6
Chapter6Chapter6
Chapter6
 
RelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdfRelationalAlgebra-RelationalCalculus-SQL.pdf
RelationalAlgebra-RelationalCalculus-SQL.pdf
 
Relational algebra
Relational algebraRelational algebra
Relational algebra
 
Relational Algebra Operations
Relational Algebra OperationsRelational Algebra Operations
Relational Algebra Operations
 
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
 

Dernier

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.MateoGardella
 
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 GraphThiyagu K
 
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 ConsultingTechSoup
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
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...christianmathematics
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 

Dernier (20)

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
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
 
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
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
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...
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 

Relational algebra (basics)

  • 2. Lecture overview  Five Basic Operators of Relational Algebra:  Select  Project  Union  Intersection  Cartesian product 6) Formulating queries
  • 3. Relational Algebra  The relational algebra is a procedural query language  It consists of a set of operations that take one or two relations as input and produce a new relation as their result  There are five basic operations of relational algebra.
  • 4. Unary Operations  These are those operations, which involve only one relation or table  These are:  Select  Project
  • 5. Binary Operations  These are those operations, which involve pairs of relations and are, therefore called binary operations  The input for these operations is two relations and they produce a new relation without changing the original relations  These operations are:  Union  Set difference  Cartesian product
  • 6. Select Operation  The select operation is performed to select certain rows or tuples of a table, so it performs its action on the table horizontally  The tuples are selected through this operation using a predicate or condition  This command works on a single table and takes rows that meet a specified condition, copying them into a new table  Denoted by lower Greek letter sigma (σ)
  • 8. Other operators  In selection operation the comparison operators like <, >, =, <=, >=, <> can be used in the predicate  Similarly, we can also combine several simple predicates into a larger predicate using the connectives and (^ ) and or (˅).
  • 9. Project Operation  The Select operation works horizontally on the table on the other hand the Project operator operates on a single table vertically  It produces a vertical subset of the table, extracting the values of specified columns, eliminating duplicates, and placing the values in a new table
  • 10. Project Operation  It is unary operation that returns its argument relation, with certain attributes left out  Since relation is a set any duplicate rows are eliminated  Projection is denoted by a Greek letter (Π )  While using this operator all the rows of selected attributes of a relation are part of new relation
  • 12. Composition of relational operators  The relational operators like select and project can also be used in nested forms iteratively  As the result of an operation is a relation so this result can be used as an input for other operation  Order is very important
  • 14. Binary Operations  These are those operations, which involve pairs of relations and are, therefore called binary operations  The input for these operations is two relations and they produce a new relation without changing the original relations  These operations are:  Union  Set difference  Cartesian product
  • 15. Union Operations  The first requirement for union operator is that both the relations should be union compatible  It means that relations must meet the following two conditions:  Both the relations should be of same degree, which means that the number of attributes in both relations should be exactly same  The domains of corresponding attributes in both the relations should be same.
  • 16. Union Operation  It is denoted by U  If R and S are two relations, which are union compatible, if we take union of these two relations then the resulting relation would be the set of tuples either in R or S or both  Since it is set so there are no duplicate tuples  The union operator is commutative which means: R U S = S U R
  • 18. Intersection Operation  The intersection operation also has the requirement that both the relations should be union compatible i.e they are of same degree and same domains. It is represented by  If R and S are two relations and we take intersection of these two relations then the resulting relation would be the set of tuples, which are in both R and S  Just like union intersection is also commutative. R S = S R
  • 20. Set Difference Operation  If R and S are two relations which are union compatible then difference of these two relations will be set of tuples that appear in R but do not appear in S. It is denoted by (-)
  • 22. Cartesian Product  The Cartesian product needs not to be union compatible  It means they can be of different degree  It is denoted by X  Suppose there is a relation R and S  The Cartesian product will be: R X S It is also called cross product
  • 24. Lab Activity-10  Hide columns  Create relationships
  • 25. Next Lecture  Relational Algebra 2 (Joins)