SlideShare una empresa de Scribd logo
1 de 30
Relational Operation
Presented by:-
Nikhat , Abhishek, Shubham, Sonu & Riya
WHAT IS RELATIONAL
ALGEBRA?
• It is a Procedural Query Language.
• It is just a Mathematical Function that is used to retrieve queries by
describing a sequence of operation on their tables or even databases
involved.
FUNDAMENTAL OPERATION IN RELATIONAL
ALGEBRA:-
• SELECTION.
• PROJECTION.
• SET DIFFERENCE.
• CARTESIAN PRODUCT.
• UNION.
• RENAME.
SELECTION OPERATION
EID ENAME
1 A
2 B
3 C
• It is denoted by ‘σ’ Sigma symbol.
• SYNTAX:- σ(SELECT CONDITION)R.
• In Relational Algebra to retrieve data from a tuple selection
operation is used.
IMPORTANT POINTS:-
• Selection Operation can use comparisons using ‘=‘, ’<‘, ’<=‘, ‘>’,
‘>=‘, ‘!=‘ operators.
• We can Merge two Select Condition with the help of
“CONNECTIVES”.
• The Connectives used are AND(∧),OR(∨),and NOT(¬).
• Select Operation is “COMMUTATIVE”.
EID CITY ENAME SAL
1 DELHI A 1K
2 MUMBAI B 2K
3 DELHI C 3K
4 CHENNAI D 4K
When we write:-
σ CITY=DELHI(EMPLOYEE)
RESULT:-
1 DELHI A 1K
3 DELHI C 3K
If we will write:
σ
sal>2k[σCITY=DELHI]EMPLOYEE]
RESULT:-
3
DELHI
C 3K
If we will write like this:
[ σ sal>2kEMPLOYEE]
RESULT:-
3 DELHI C 3K
4 CHENN
AI
D 4K
Then we will write:-
σ CITY=DELHI[σSal>2K
(EMPLOYEE)]
RESULT:-
3
DEL
HI
C 3K
Projection
Operation
Projection (∏) Pi
• Projection is used to project required column data from a
relation.
• Projection is kind portioning which is vertical basically we
dividing the table vertically
By Default projection removes duplicate data.
𝜋(attribute 𝑙𝑖𝑠𝑡)(Relation)
Emp
X Y Z
1 a c
1 b c
2 a c
2 b c
𝜋(XY)(Emp)
X Y
1 a
1 b
2 a
2 b
𝜋(Z)(Emp)
Z
c
SELECT ≅ 𝑷𝒓𝒐𝒋𝒆𝒄𝒕𝒊𝒐𝒏
SELECT DISTINCT ≅ 𝑷𝒓𝒐𝒋𝒆𝒄𝒕𝒊𝒐𝒏
SET
OPERATION
What are the SET operation possible on the Relational
Algebra Operation?
Till now what ever operation we have seen they are unary now we are going to see binary mean we have to take to two
Relations and operate on it
Now when ever we have to take two operation to operate on it (Union, Interaction, Set Difference) they should we
compatible for this Operation
1.Union (U)
2.Set Difference (-)
Union Operation (U)
It performs binary union between two given relations and is defined as.
R U S
Where R and S are either database relations or relation result set (temporary relation).
For a union operation to be valid, the following conditions must hold −
• R and S must have the same number of attributes.
• Attribute domains must be compatible.
• Duplicate tuples are automatically eliminated.
Ex: of Union Operation
∏ author (Books) ∪ ∏ author (Articles)
Output − Projects the names of the authors who have either written a book or
an article or both.
Set Difference (-)
The result of set difference operation is tuples, which are present in one relation
but are not in the second relation.
(R-S)
What ever tuples are present in R and not present in S they will be present in Result
Finds all the tuples that are present in r but not
in s.
∏ author (Books) − ∏ author (Articles)
Output − Provides the name of authors who have written books but not
articles.
Union Operation (∪)
It performs binary union between two given relations and is defined as −
r ∪ s = { t | t ∈ r or t ∈ s}
Notation − r U s
Where r and s are either database relations or relation result set (temporary
relation).
For a union operation to be valid, the following conditions must hold−
 r, and s must have the same number of attributes.
 Attribute domains must be compatible.
 Duplicate tuples are automatically eliminated.
S1 S2
S1∪S2
sno descrip price
1 pen 15
2 pencil 4
3 rubber 5
sno descrip price
8 Scissor 10
11 Scale 5
sno descrip price
1 pen 15
2 pencil 4
3 rubber 5
8 Scissor 10
11 Scale 5
Q. Find the names of all bank customer who have either an account or loan or both.
account(ano,bname,bal)
branch(bname,bcity,assets)
customer(cname,cstreet,ccity)
loan(lno,bname,amt)
 depositor(cname,ano)
 borrower(cname,cno)
cname (borrower) =>{xyz,qwerty,abc,mohan}
cname (depositor) =>{mnop,asd,mohan}
cname (borrower) ∪ cname (depositor)
=> {xyz,qwerty,abc,mohan, mnop,asd}
Cartesian Product
• Each tuple in R1 with each tuple in R2
• Notation: R1  R2
• Example:
– Employee  Dependents
Cartesian Product Example
Employee
Name SSN
John 999999999
Tony 777777777
Dependents
EmployeeSSN Dname
999999999 Emily
777777777 Joe
Employee x Dependents
Name SSN EmployeeSSN Dname
John 999999999 999999999 Emily
John 999999999 777777777 Joe
Tony 777777777 999999999 Emily
Tony 777777777 777777777 Joe
RENAME
OPERATION
The results of relational algebra are also relations but without any name.
Rename is a unary operation which allows us to rename the output
relation.
The rename operation is denoted using small Greek letter rho (ρ).
Rename operator represented as:
ρ x (E)
To rename STUDENT relation to STUDENT1, we can use
rename operator like:
ρ ( STUDENT)
STUDENT1
If you want to create a relation STUDENT_NAMES with
ROLL_NO and NAME from STUDENT, it can be done using
rename operator as:
ρ(STUDENT_NAMES, ∏(ROLL_NO, NAME)(STUDENT))

Más contenido relacionado

La actualidad más candente

[1062BPY12001] Data analysis with R / April 26
[1062BPY12001] Data analysis with R / April 26[1062BPY12001] Data analysis with R / April 26
[1062BPY12001] Data analysis with R / April 26Kevin Chun-Hsien Hsu
 
c++ programming Unit 4 operators
c++ programming Unit 4 operatorsc++ programming Unit 4 operators
c++ programming Unit 4 operatorsAAKASH KUMAR
 
SQL Functions and Operators
SQL Functions and OperatorsSQL Functions and Operators
SQL Functions and OperatorsMohan Kumar.R
 
ML - Multiple Linear Regression
ML - Multiple Linear RegressionML - Multiple Linear Regression
ML - Multiple Linear RegressionAndrew Ferlitsch
 
Affine Array Indexes
Affine Array IndexesAffine Array Indexes
Affine Array IndexesNilaNila16
 
Solving of Non-Linear Equations-1.pptx
Solving of Non-Linear Equations-1.pptxSolving of Non-Linear Equations-1.pptx
Solving of Non-Linear Equations-1.pptxabelmeketa
 
Introduction to Quasiquotes
Introduction to QuasiquotesIntroduction to Quasiquotes
Introduction to QuasiquotesKnoldus Inc.
 
Operation and expression in c++
Operation and expression in c++Operation and expression in c++
Operation and expression in c++Online
 
Solving Simultaneous Linear Equations-1.pptx
Solving Simultaneous Linear Equations-1.pptxSolving Simultaneous Linear Equations-1.pptx
Solving Simultaneous Linear Equations-1.pptxabelmeketa
 
curve fitting or regression analysis-1.pptx
curve fitting or regression analysis-1.pptxcurve fitting or regression analysis-1.pptx
curve fitting or regression analysis-1.pptxabelmeketa
 
Principles of functional progrmming in scala
Principles of functional progrmming in scalaPrinciples of functional progrmming in scala
Principles of functional progrmming in scalaehsoon
 
PC 1 continuity notes
PC 1 continuity notesPC 1 continuity notes
PC 1 continuity notesvhiggins1
 
General Mathematics - Representation and Types of Functions
General Mathematics - Representation and Types of FunctionsGeneral Mathematics - Representation and Types of Functions
General Mathematics - Representation and Types of FunctionsJuan Miguel Palero
 

La actualidad más candente (20)

[1062BPY12001] Data analysis with R / April 26
[1062BPY12001] Data analysis with R / April 26[1062BPY12001] Data analysis with R / April 26
[1062BPY12001] Data analysis with R / April 26
 
c++ programming Unit 4 operators
c++ programming Unit 4 operatorsc++ programming Unit 4 operators
c++ programming Unit 4 operators
 
Recursion Lecture in Java
Recursion Lecture in JavaRecursion Lecture in Java
Recursion Lecture in Java
 
SQL Functions and Operators
SQL Functions and OperatorsSQL Functions and Operators
SQL Functions and Operators
 
Ch7
Ch7Ch7
Ch7
 
2 r algebra
2 r algebra2 r algebra
2 r algebra
 
ML - Multiple Linear Regression
ML - Multiple Linear RegressionML - Multiple Linear Regression
ML - Multiple Linear Regression
 
Affine Array Indexes
Affine Array IndexesAffine Array Indexes
Affine Array Indexes
 
Solving of Non-Linear Equations-1.pptx
Solving of Non-Linear Equations-1.pptxSolving of Non-Linear Equations-1.pptx
Solving of Non-Linear Equations-1.pptx
 
Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and Destructors
 
Introduction to Quasiquotes
Introduction to QuasiquotesIntroduction to Quasiquotes
Introduction to Quasiquotes
 
Operation and expression in c++
Operation and expression in c++Operation and expression in c++
Operation and expression in c++
 
Solving Simultaneous Linear Equations-1.pptx
Solving Simultaneous Linear Equations-1.pptxSolving Simultaneous Linear Equations-1.pptx
Solving Simultaneous Linear Equations-1.pptx
 
curve fitting or regression analysis-1.pptx
curve fitting or regression analysis-1.pptxcurve fitting or regression analysis-1.pptx
curve fitting or regression analysis-1.pptx
 
1.2 matlab numerical data
1.2  matlab numerical data1.2  matlab numerical data
1.2 matlab numerical data
 
Principles of functional progrmming in scala
Principles of functional progrmming in scalaPrinciples of functional progrmming in scala
Principles of functional progrmming in scala
 
PC 1 continuity notes
PC 1 continuity notesPC 1 continuity notes
PC 1 continuity notes
 
General Mathematics - Representation and Types of Functions
General Mathematics - Representation and Types of FunctionsGeneral Mathematics - Representation and Types of Functions
General Mathematics - Representation and Types of Functions
 
JavaScript Operators
JavaScript OperatorsJavaScript Operators
JavaScript Operators
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
 

Similar a Relational operation final

Intro to relational model
Intro to relational modelIntro to relational model
Intro to relational modelATS SBGI MIRAJ
 
Chapter – 5 Relational Algebra.pdf
Chapter – 5 Relational Algebra.pdfChapter – 5 Relational Algebra.pdf
Chapter – 5 Relational Algebra.pdfTamiratDejene1
 
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
 
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
 
Relational Algebra
Relational AlgebraRelational Algebra
Relational AlgebraAmin Omi
 
Relational Algebra Operations
Relational Algebra OperationsRelational Algebra Operations
Relational Algebra OperationsShefa Idrees
 
Module 2-2.ppt
Module 2-2.pptModule 2-2.ppt
Module 2-2.pptShylaja40
 
Relational Algebra.ppt
Relational Algebra.pptRelational Algebra.ppt
Relational Algebra.pptSreenivas R
 
4. SQL in DBMS
4. SQL in DBMS4. SQL in DBMS
4. SQL in DBMSkoolkampus
 
1695304562_RELATIONAL_ALGEBRA.pdf
1695304562_RELATIONAL_ALGEBRA.pdf1695304562_RELATIONAL_ALGEBRA.pdf
1695304562_RELATIONAL_ALGEBRA.pdfKavinilaa
 
Chapter-6 Relational Algebra
Chapter-6 Relational AlgebraChapter-6 Relational Algebra
Chapter-6 Relational AlgebraKunal Anand
 
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Prosanta Ghosh
 
CHAPTER 2 DBMS IN EASY WAY BY MILAN PATEL
CHAPTER 2 DBMS IN EASY WAY BY  MILAN PATELCHAPTER 2 DBMS IN EASY WAY BY  MILAN PATEL
CHAPTER 2 DBMS IN EASY WAY BY MILAN PATELShashi Patel
 

Similar a Relational operation final (20)

Intro to relational model
Intro to relational modelIntro to relational model
Intro to relational model
 
Chapter – 5 Relational Algebra.pdf
Chapter – 5 Relational Algebra.pdfChapter – 5 Relational Algebra.pdf
Chapter – 5 Relational Algebra.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)
 
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)
 
RDBMS
RDBMSRDBMS
RDBMS
 
Relational Algebra
Relational AlgebraRelational Algebra
Relational Algebra
 
Relational Algebra Operations
Relational Algebra OperationsRelational Algebra Operations
Relational Algebra Operations
 
Module 2-2.ppt
Module 2-2.pptModule 2-2.ppt
Module 2-2.ppt
 
Relational Algebra.ppt
Relational Algebra.pptRelational Algebra.ppt
Relational Algebra.ppt
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
4. SQL in DBMS
4. SQL in DBMS4. SQL in DBMS
4. SQL in DBMS
 
1695304562_RELATIONAL_ALGEBRA.pdf
1695304562_RELATIONAL_ALGEBRA.pdf1695304562_RELATIONAL_ALGEBRA.pdf
1695304562_RELATIONAL_ALGEBRA.pdf
 
Chapter-6 Relational Algebra
Chapter-6 Relational AlgebraChapter-6 Relational Algebra
Chapter-6 Relational Algebra
 
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013
 
14285 lecture2
14285 lecture214285 lecture2
14285 lecture2
 
CHAPTER 2 DBMS IN EASY WAY BY MILAN PATEL
CHAPTER 2 DBMS IN EASY WAY BY  MILAN PATELCHAPTER 2 DBMS IN EASY WAY BY  MILAN PATEL
CHAPTER 2 DBMS IN EASY WAY BY MILAN PATEL
 
Relational Algebra-23-04-2023.pdf
Relational Algebra-23-04-2023.pdfRelational Algebra-23-04-2023.pdf
Relational Algebra-23-04-2023.pdf
 
relational algebra
relational algebrarelational algebra
relational algebra
 

Último

9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
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
 
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.pdfJayanti Pande
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
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
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 

Último (20)

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
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
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...
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
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
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 

Relational operation final

  • 1. Relational Operation Presented by:- Nikhat , Abhishek, Shubham, Sonu & Riya
  • 3. • It is a Procedural Query Language. • It is just a Mathematical Function that is used to retrieve queries by describing a sequence of operation on their tables or even databases involved.
  • 4. FUNDAMENTAL OPERATION IN RELATIONAL ALGEBRA:- • SELECTION. • PROJECTION. • SET DIFFERENCE. • CARTESIAN PRODUCT. • UNION. • RENAME.
  • 6. • It is denoted by ‘σ’ Sigma symbol. • SYNTAX:- σ(SELECT CONDITION)R. • In Relational Algebra to retrieve data from a tuple selection operation is used.
  • 7. IMPORTANT POINTS:- • Selection Operation can use comparisons using ‘=‘, ’<‘, ’<=‘, ‘>’, ‘>=‘, ‘!=‘ operators. • We can Merge two Select Condition with the help of “CONNECTIVES”. • The Connectives used are AND(∧),OR(∨),and NOT(¬). • Select Operation is “COMMUTATIVE”.
  • 8. EID CITY ENAME SAL 1 DELHI A 1K 2 MUMBAI B 2K 3 DELHI C 3K 4 CHENNAI D 4K
  • 9. When we write:- σ CITY=DELHI(EMPLOYEE) RESULT:- 1 DELHI A 1K 3 DELHI C 3K
  • 10. If we will write: σ sal>2k[σCITY=DELHI]EMPLOYEE] RESULT:- 3 DELHI C 3K
  • 11. If we will write like this: [ σ sal>2kEMPLOYEE] RESULT:- 3 DELHI C 3K 4 CHENN AI D 4K Then we will write:- σ CITY=DELHI[σSal>2K (EMPLOYEE)] RESULT:- 3 DEL HI C 3K
  • 13. Projection (∏) Pi • Projection is used to project required column data from a relation. • Projection is kind portioning which is vertical basically we dividing the table vertically By Default projection removes duplicate data. 𝜋(attribute 𝑙𝑖𝑠𝑡)(Relation)
  • 14. Emp X Y Z 1 a c 1 b c 2 a c 2 b c 𝜋(XY)(Emp) X Y 1 a 1 b 2 a 2 b 𝜋(Z)(Emp) Z c
  • 15. SELECT ≅ 𝑷𝒓𝒐𝒋𝒆𝒄𝒕𝒊𝒐𝒏 SELECT DISTINCT ≅ 𝑷𝒓𝒐𝒋𝒆𝒄𝒕𝒊𝒐𝒏
  • 17. What are the SET operation possible on the Relational Algebra Operation?
  • 18. Till now what ever operation we have seen they are unary now we are going to see binary mean we have to take to two Relations and operate on it Now when ever we have to take two operation to operate on it (Union, Interaction, Set Difference) they should we compatible for this Operation
  • 20. Union Operation (U) It performs binary union between two given relations and is defined as. R U S Where R and S are either database relations or relation result set (temporary relation). For a union operation to be valid, the following conditions must hold − • R and S must have the same number of attributes. • Attribute domains must be compatible. • Duplicate tuples are automatically eliminated.
  • 21. Ex: of Union Operation ∏ author (Books) ∪ ∏ author (Articles) Output − Projects the names of the authors who have either written a book or an article or both.
  • 22. Set Difference (-) The result of set difference operation is tuples, which are present in one relation but are not in the second relation. (R-S) What ever tuples are present in R and not present in S they will be present in Result Finds all the tuples that are present in r but not in s. ∏ author (Books) − ∏ author (Articles) Output − Provides the name of authors who have written books but not articles.
  • 23. Union Operation (∪) It performs binary union between two given relations and is defined as − r ∪ s = { t | t ∈ r or t ∈ s} Notation − r U s Where r and s are either database relations or relation result set (temporary relation). For a union operation to be valid, the following conditions must hold−  r, and s must have the same number of attributes.  Attribute domains must be compatible.  Duplicate tuples are automatically eliminated.
  • 24. S1 S2 S1∪S2 sno descrip price 1 pen 15 2 pencil 4 3 rubber 5 sno descrip price 8 Scissor 10 11 Scale 5 sno descrip price 1 pen 15 2 pencil 4 3 rubber 5 8 Scissor 10 11 Scale 5
  • 25. Q. Find the names of all bank customer who have either an account or loan or both. account(ano,bname,bal) branch(bname,bcity,assets) customer(cname,cstreet,ccity) loan(lno,bname,amt)  depositor(cname,ano)  borrower(cname,cno) cname (borrower) =>{xyz,qwerty,abc,mohan} cname (depositor) =>{mnop,asd,mohan} cname (borrower) ∪ cname (depositor) => {xyz,qwerty,abc,mohan, mnop,asd}
  • 26. Cartesian Product • Each tuple in R1 with each tuple in R2 • Notation: R1  R2 • Example: – Employee  Dependents
  • 27. Cartesian Product Example Employee Name SSN John 999999999 Tony 777777777 Dependents EmployeeSSN Dname 999999999 Emily 777777777 Joe Employee x Dependents Name SSN EmployeeSSN Dname John 999999999 999999999 Emily John 999999999 777777777 Joe Tony 777777777 999999999 Emily Tony 777777777 777777777 Joe
  • 29. The results of relational algebra are also relations but without any name. Rename is a unary operation which allows us to rename the output relation. The rename operation is denoted using small Greek letter rho (ρ). Rename operator represented as: ρ x (E)
  • 30. To rename STUDENT relation to STUDENT1, we can use rename operator like: ρ ( STUDENT) STUDENT1 If you want to create a relation STUDENT_NAMES with ROLL_NO and NAME from STUDENT, it can be done using rename operator as: ρ(STUDENT_NAMES, ∏(ROLL_NO, NAME)(STUDENT))