SlideShare a Scribd company logo
1 of 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)

More Related Content

What's hot

basic structure of SQL FINAL.pptx
basic structure of SQL FINAL.pptxbasic structure of SQL FINAL.pptx
basic structure of SQL FINAL.pptxAnusha sivakumar
 
SQL - Structured query language introduction
SQL - Structured query language introductionSQL - Structured query language introduction
SQL - Structured query language introductionSmriti Jain
 
Database : Relational Data Model
Database : Relational Data ModelDatabase : Relational Data Model
Database : Relational Data ModelSmriti Jain
 
Sql joins inner join self join outer joins
Sql joins inner join self join outer joinsSql joins inner join self join outer joins
Sql joins inner join self join outer joinsDeepthi Rachumallu
 
Command line-arguments-in-java-tutorial
Command line-arguments-in-java-tutorialCommand line-arguments-in-java-tutorial
Command line-arguments-in-java-tutorialKuntal Bhowmick
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMSkoolkampus
 
language , grammar and automata
language , grammar and automatalanguage , grammar and automata
language , grammar and automataElakkiyaS11
 
3. Relational Models in DBMS
3. Relational Models in DBMS3. Relational Models in DBMS
3. Relational Models in DBMSkoolkampus
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model IntroductionNishant Munjal
 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts Bharat Kalia
 
DBMS Assignments Questions
DBMS Assignments QuestionsDBMS Assignments Questions
DBMS Assignments QuestionsSara Sahu
 
7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMSkoolkampus
 
Database Modeling Using Entity.. Weak And Strong Entity Types
Database Modeling Using Entity.. Weak And Strong Entity TypesDatabase Modeling Using Entity.. Weak And Strong Entity Types
Database Modeling Using Entity.. Weak And Strong Entity Typesaakanksha s
 

What's hot (20)

basic structure of SQL FINAL.pptx
basic structure of SQL FINAL.pptxbasic structure of SQL FINAL.pptx
basic structure of SQL FINAL.pptx
 
SQL - Structured query language introduction
SQL - Structured query language introductionSQL - Structured query language introduction
SQL - Structured query language introduction
 
Database : Relational Data Model
Database : Relational Data ModelDatabase : Relational Data Model
Database : Relational Data Model
 
Sql joins inner join self join outer joins
Sql joins inner join self join outer joinsSql joins inner join self join outer joins
Sql joins inner join self join outer joins
 
Command line-arguments-in-java-tutorial
Command line-arguments-in-java-tutorialCommand line-arguments-in-java-tutorial
Command line-arguments-in-java-tutorial
 
Database language
Database languageDatabase language
Database language
 
SQL JOIN
SQL JOINSQL JOIN
SQL JOIN
 
Using the set operators
Using the set operatorsUsing the set operators
Using the set operators
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
language , grammar and automata
language , grammar and automatalanguage , grammar and automata
language , grammar and automata
 
3. Relational Models in DBMS
3. Relational Models in DBMS3. Relational Models in DBMS
3. Relational Models in DBMS
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts
 
Joins in SQL
Joins in SQLJoins in SQL
Joins in SQL
 
Uml class-diagram
Uml class-diagramUml class-diagram
Uml class-diagram
 
ER Model in DBMS
ER Model in DBMSER Model in DBMS
ER Model in DBMS
 
DBMS Assignments Questions
DBMS Assignments QuestionsDBMS Assignments Questions
DBMS Assignments Questions
 
7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMS
 
Database Modeling Using Entity.. Weak And Strong Entity Types
Database Modeling Using Entity.. Weak And Strong Entity TypesDatabase Modeling Using Entity.. Weak And Strong Entity Types
Database Modeling Using Entity.. Weak And Strong Entity Types
 

Similar to 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
 

Similar to 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
 

Recently uploaded

Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 

Recently uploaded (20)

Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 

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)