SlideShare una empresa de Scribd logo
1 de 20
.
[object Object],[object Object],[object Object],[object Object],[object Object],BASICS OF RELATIONAL ALGEBRA
BASIC SET ORIENTED OPERATIONS NATIVE RELATIONAL OPERATIONS NAME SYMBOL SELECTION σ PROJECTION Π JOIN DIVISION ÷ RENAME ρ ASSIGNMENT 
UNION A B R=A U B ROLL.NO NAME 12505 SHARAN 12506 SANGEETA 12507 SHYNA ROLL.NO NAME 12502 PRABJOT 125O7 SHYNA 12520 POOJA 12521 RINKI ROLL.NO NAME 12502 PRABJOT 12505 SHARAN 12506 SANGEETA 12507 SHYNA 12520 POOJA 12521 RINKI
INTERSECTION A B R=A ∩ B ROLL.NO NAME 12502 PRABJOT 12505 SHARAN 12507 SHYNA 12521 RINKI ROLL.NO NAME 12507 SHYNA 12519 POOJA 12521 RINKI ROLL.NO NAME 12507 SHYNA 12521 RINKI
DIFFERENCE B A R=A-B R=B-A ROLL.NO NAME 12502 PRABJOT 12505 SHARAN 12507 SHYNA 12521 RINKI ROLL.NO NAME 12507 SHYNA 12519 POOJA 12514 NEETU 12521 RINKI ROLL.NO NAME 12502 PRABJOT 12505 SHARAN ROLL.NO NAME 12519 POOJA 12514 NEETU
CARTESIAN PRODUCT A B R=A × B ROLL.NO NAME 12502 PRABJOT 12505 SHARAN 12507 SHYNA 12521 RINKI ROLL.NO NAME 12507 SHYNA 12519 POOJA ROLL.NO NAME ROLL.NO NAME 12502 PRABJOT 12507 SHYNA 12502 PRABJOT 12519 POOJA 12505 SHARAN 12507 SHYNA 12505 SHARAN 12519 POOJA 12507 SHYNA 12507 SHYNA 12507 SHYNA 12519 POOJA 12521 RINKI 12507 SHYNA 12521 RINKI 12521 POOJA
EMPLOYEE   SELECTION RESULTING TABLE σ AGE >32 (EMPLOYEE) ID NAME SALARY AGE 101 AMIT 4500 30 102 AJAY 5000 35 105 JOHN 5000 36 106 ABHI 4000 28 107 ALI 4800 31 108 SUNIL 3500 33 ID NAME SALARY AGE 102 AJAY 5000 35 105 JOHN 5000 36 108 SUNIL 3500 33
PROJECTION EMPLOYEE   RESULTING TABLES   A.  π   ID (EMPLOYEE)   B.  π   NAME,AGE (EMPLOYEE)   B   A   ID NAME SALARY AGE 101 AMIT 4500 30 102 AJAY 5000 35 105 JOHN 5000 36 106 ABHI 4000 28 107 ALI 4800 31 108 SUNIL 3500 33 109 JOHN 4600 29 NAME AGE AMIT 30 AJAY 35 JOHN 36 ABHI 28 ALI 31 SUNIL 33 JOHN 29 ID 101 102 105 106 107 108 109
COURSE(C)   S   JOIN   RESULTING TABLE( EQUI-JOIN ) COURSE=C_ID  (C)  STU(S)   ROLL.NO NAME COURSE 101 PIYUSH M-01 102 SUMIT M-02 103 SHEENA M-04 104 RITU M-03 C_ID C_NAME C_DUR M-01 MBA(HR) 2 M-02 MSC(PHY) 2 M-03 MSC(IT) 2 M-04 MCA 3 ROLL.NO NAME COURSE 101 PIYUSH M-01 102 SUMIT M-02 103 SHEENA M-04 104 RITU M-03 C_ID C_NAME C_DUR M-01 MBA(HR) 2 M-02 MSC(PHY) 2 M-04 MCA 3 M-03 MSC(IT) 2
COURSE(C)   NATURAL  JOIN  ON  S   AND  C NATURAL JOIN(INNER JOIN) STU(S)   ROLL.NO NAME COURSE 101 PIYUSH M-01 102 SUMIT M-02 103 SHEENA M-04 104 RITU M-03 C_NAME C_DUR MBA(HR) 2 MSC(PHY) 2 MCA 3 MSC(IT) 2 ROLL.NO NAME COURSE 101 PIYUSH M-01 102 SUMIT M-02 103 SHEENA M-04 104 RITU M-03 C_ID C_NAME C_DUR M-01 MBA(HR) 2 M-02 MSC(PHY) 2 M-03 MSC(IT) 2 M-04 MCA 3
DIVISION   MAIN   R1   SUB2   SUB3 RESULTING TABLES  R3   R3  MAIN ÷ SUB3   R2 R1  MAIN ÷ SUB1 R2  MAIN ÷ SUB2   SUB1   ASSIGNMENT   A B A1 B1 A3 B2 A2 B3 A2 B1 A1 B3 A3 B3 A3 B1 B B1 B3 B B2 B B2 B3 A A1 A2 A3 A A3 A A3
ρ ,[object Object],RENAME   x (R) ρ x(A1,A2,A3…An) (R)
ADDITIONAL RELATIONAL OPERATORS   ,[object Object],[object Object],[object Object],[object Object],[object Object]
Aggregate functions and grouping (R) COUNT EMP_ID, SUM SALARY £   (R)  DEP_ID   £   COUNT EMP_ID, MAXIMUM SALARY (R)  EMP_ID NAME DEP_ID SALARY 250 RAVI 10 5600 251 ANUJ 11 4000 252 JOHN 13 10000 253 AJIT 10 4500 254 RAVI 13 9000 256 AJAY 11 5000 257 ANUJ 11 3000 258 JOHN 10 2000 DEP_ID COUNT EMP_ID SUM SALARY 10 3 12100 11 3 12000 13 2 19000 COUNT EMP_ID MAX SALARY 9 10000
In outer join ,the rows in one relation having no matching rows in the other Relation will also appear in the resulting table with nulls in other attributes positions instead of being ignored . OUTER JOIN ,[object Object],[object Object],[object Object],[object Object]
LEFT  OUTER JOIN EMP(E) DEPT(D) E   D   EMP_ID E_NAME AGE DEP_NO 101 AJAY 28 10 103 AMIT 33 11 104 PIYUSH 30 10 107 AJIT 23 NULL DEP_ID D_NAME 10 CREDIT 11 LOAN 12 CASH EMP_ID E_NAME AGE D_NAME 101 AJAY 28 CREDIT 103 AMIT 33 LOAN 104 PIYUSH 30 CREDIT 107 AJIT 23 NULL
RIGHT  OUTER JOIN EMP(E) DEPT(D) E   D   DEP_ID D_NAME 10 CREDIT 11 LOAN 12 CASH EMP_ID E_NAME AGE DEP_NO 101 AJAY 28 10 103 AMIT 33 11 104 PIYUSH 30 10 107 AJIT 23 NULL EMP_ID E_NAME AGE D_NAME 101 AJAY 28 CREDIT 103 AMIT 33 LOAN 104 PIYUSH 30 CREDIT NULL NULL NULL CASH
FULL  OUTER  JOIN EMP(E) DEPT(D) E   D   DEP_ID D_NAME 10 CREDIT 11 LOAN 12 CASH EMP_ID E_NAME AGE DEP_NO 101 AJAY 28 10 103 AMIT 33 11 104 PIYUSH 30 10 107 AJIT 23 NULL EMP_ID E_NAME AGE D_NAME 101 AJAY 28 CREDIT 103 AMIT 33 LOAN 104 PIYUSH 30 CREDIT 107 AJIT 23 NULL NULL NULL NULL CASH
Relational algebra

Más contenido relacionado

La actualidad más candente

Lecture 04 normalization
Lecture 04 normalization Lecture 04 normalization
Lecture 04 normalization
emailharmeet
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
koolkampus
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
ghhgj jhgh
 
5 the relational algebra and calculus
5 the relational algebra and calculus5 the relational algebra and calculus
5 the relational algebra and calculus
Kumar
 

La actualidad más candente (20)

Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMS
 
Relational model
Relational modelRelational model
Relational model
 
Lecture 04 normalization
Lecture 04 normalization Lecture 04 normalization
Lecture 04 normalization
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
joins in database
 joins in database joins in database
joins in database
 
Functions in discrete mathematics
Functions in discrete mathematicsFunctions in discrete mathematics
Functions in discrete mathematics
 
Relational Algebra
Relational AlgebraRelational Algebra
Relational Algebra
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Integrity constraints in dbms
Integrity constraints in dbmsIntegrity constraints in dbms
Integrity constraints in dbms
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
relational algebra
relational algebrarelational algebra
relational algebra
 
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
5 the relational algebra and calculus
5 the relational algebra and calculus5 the relational algebra and calculus
5 the relational algebra and calculus
 
stack & queue
stack & queuestack & queue
stack & queue
 
Er model ppt
Er model pptEr model ppt
Er model ppt
 

Destacado

Relational Algebra
Relational AlgebraRelational Algebra
Relational Algebra
guest20b0b3
 
Relational Algebra-Database Systems
Relational Algebra-Database SystemsRelational Algebra-Database Systems
Relational Algebra-Database Systems
jakodongo
 
My slide relational algebra
My slide  relational algebraMy slide  relational algebra
My slide relational algebra
Rushdi Shams
 
B2 c business models
B2 c business modelsB2 c business models
B2 c business models
Sartaj
 

Destacado (20)

Relational Algebra
Relational AlgebraRelational Algebra
Relational Algebra
 
Relational Algebra-Database Systems
Relational Algebra-Database SystemsRelational Algebra-Database Systems
Relational Algebra-Database Systems
 
Relational Model and Relational Algebra - Lecture 3 - Introduction to Databas...
Relational Model and Relational Algebra - Lecture 3 - Introduction to Databas...Relational Model and Relational Algebra - Lecture 3 - Introduction to Databas...
Relational Model and Relational Algebra - Lecture 3 - Introduction to Databas...
 
Relational algebra-and-relational-calculus
Relational algebra-and-relational-calculusRelational algebra-and-relational-calculus
Relational algebra-and-relational-calculus
 
Lec02
Lec02Lec02
Lec02
 
Relational Algebra,Types of join
Relational Algebra,Types of joinRelational Algebra,Types of join
Relational Algebra,Types of join
 
Introduction to Relational Algebra
Introduction to Relational AlgebraIntroduction to Relational Algebra
Introduction to Relational Algebra
 
SQL JOIN
SQL JOINSQL JOIN
SQL JOIN
 
Sql ppt
Sql pptSql ppt
Sql ppt
 
A must Sql notes for beginners
A must Sql notes for beginnersA must Sql notes for beginners
A must Sql notes for beginners
 
Dbms slides
Dbms slidesDbms slides
Dbms slides
 
B2C Business models
B2C Business modelsB2C Business models
B2C Business models
 
ÁLGEBRA RELACIONAL
ÁLGEBRA RELACIONALÁLGEBRA RELACIONAL
ÁLGEBRA RELACIONAL
 
Relational algebra
Relational algebraRelational algebra
Relational algebra
 
Relational Algebra
Relational AlgebraRelational Algebra
Relational Algebra
 
Rrelational algebra in dbms overview
Rrelational algebra in dbms overviewRrelational algebra in dbms overview
Rrelational algebra in dbms overview
 
My slide relational algebra
My slide  relational algebraMy slide  relational algebra
My slide relational algebra
 
Relational algebra
Relational algebraRelational algebra
Relational algebra
 
Modelamiento de base de Datos - Algebra relacional
Modelamiento de base de Datos - Algebra relacionalModelamiento de base de Datos - Algebra relacional
Modelamiento de base de Datos - Algebra relacional
 
B2 c business models
B2 c business modelsB2 c business models
B2 c business models
 

Similar a Relational algebra

Introduction to Artificial Neural Networks (ANNs) - Step-by-Step Training & T...
Introduction to Artificial Neural Networks (ANNs) - Step-by-Step Training & T...Introduction to Artificial Neural Networks (ANNs) - Step-by-Step Training & T...
Introduction to Artificial Neural Networks (ANNs) - Step-by-Step Training & T...
Ahmed Gad
 
SQL WORKSHOP::Lecture 4
SQL WORKSHOP::Lecture 4SQL WORKSHOP::Lecture 4
SQL WORKSHOP::Lecture 4
Umair Amjad
 

Similar a Relational algebra (15)

DAY 2.pdf
DAY 2.pdfDAY 2.pdf
DAY 2.pdf
 
Introduction to Artificial Neural Networks (ANNs) - Step-by-Step Training & T...
Introduction to Artificial Neural Networks (ANNs) - Step-by-Step Training & T...Introduction to Artificial Neural Networks (ANNs) - Step-by-Step Training & T...
Introduction to Artificial Neural Networks (ANNs) - Step-by-Step Training & T...
 
ANSI vs Oracle language
ANSI vs Oracle languageANSI vs Oracle language
ANSI vs Oracle language
 
asal12 sqliii
asal12 sqliiiasal12 sqliii
asal12 sqliii
 
SQL WORKSHOP::Lecture 4
SQL WORKSHOP::Lecture 4SQL WORKSHOP::Lecture 4
SQL WORKSHOP::Lecture 4
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
Relational_Algebra .ppt
Relational_Algebra .pptRelational_Algebra .ppt
Relational_Algebra .ppt
 
SQL Outer Joins for Fun and Profit
SQL Outer Joins for Fun and ProfitSQL Outer Joins for Fun and Profit
SQL Outer Joins for Fun and Profit
 
Les04 Displaying Data From Multiple Table
Les04 Displaying Data From Multiple TableLes04 Displaying Data From Multiple Table
Les04 Displaying Data From Multiple Table
 
Get your moneys worth out of your database
Get your moneys worth out of your databaseGet your moneys worth out of your database
Get your moneys worth out of your database
 
Database managment System Relational Algebra
Database managment System  Relational AlgebraDatabase managment System  Relational Algebra
Database managment System Relational Algebra
 
DB2 Basic Commands - UDB
DB2 Basic Commands - UDBDB2 Basic Commands - UDB
DB2 Basic Commands - UDB
 
Relational Algibra operation
Relational Algibra  operationRelational Algibra  operation
Relational Algibra operation
 
The Five Best Things To Happen To SQL
The Five Best Things To Happen To SQLThe Five Best Things To Happen To SQL
The Five Best Things To Happen To SQL
 
Cp unit 3
Cp unit 3Cp unit 3
Cp unit 3
 

Último

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
SanaAli374401
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Último (20)

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
 
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
 
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"
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
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
 
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
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
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
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 

Relational algebra

  • 1. .
  • 2.
  • 3. BASIC SET ORIENTED OPERATIONS NATIVE RELATIONAL OPERATIONS NAME SYMBOL SELECTION σ PROJECTION Π JOIN DIVISION ÷ RENAME ρ ASSIGNMENT 
  • 4. UNION A B R=A U B ROLL.NO NAME 12505 SHARAN 12506 SANGEETA 12507 SHYNA ROLL.NO NAME 12502 PRABJOT 125O7 SHYNA 12520 POOJA 12521 RINKI ROLL.NO NAME 12502 PRABJOT 12505 SHARAN 12506 SANGEETA 12507 SHYNA 12520 POOJA 12521 RINKI
  • 5. INTERSECTION A B R=A ∩ B ROLL.NO NAME 12502 PRABJOT 12505 SHARAN 12507 SHYNA 12521 RINKI ROLL.NO NAME 12507 SHYNA 12519 POOJA 12521 RINKI ROLL.NO NAME 12507 SHYNA 12521 RINKI
  • 6. DIFFERENCE B A R=A-B R=B-A ROLL.NO NAME 12502 PRABJOT 12505 SHARAN 12507 SHYNA 12521 RINKI ROLL.NO NAME 12507 SHYNA 12519 POOJA 12514 NEETU 12521 RINKI ROLL.NO NAME 12502 PRABJOT 12505 SHARAN ROLL.NO NAME 12519 POOJA 12514 NEETU
  • 7. CARTESIAN PRODUCT A B R=A × B ROLL.NO NAME 12502 PRABJOT 12505 SHARAN 12507 SHYNA 12521 RINKI ROLL.NO NAME 12507 SHYNA 12519 POOJA ROLL.NO NAME ROLL.NO NAME 12502 PRABJOT 12507 SHYNA 12502 PRABJOT 12519 POOJA 12505 SHARAN 12507 SHYNA 12505 SHARAN 12519 POOJA 12507 SHYNA 12507 SHYNA 12507 SHYNA 12519 POOJA 12521 RINKI 12507 SHYNA 12521 RINKI 12521 POOJA
  • 8. EMPLOYEE SELECTION RESULTING TABLE σ AGE >32 (EMPLOYEE) ID NAME SALARY AGE 101 AMIT 4500 30 102 AJAY 5000 35 105 JOHN 5000 36 106 ABHI 4000 28 107 ALI 4800 31 108 SUNIL 3500 33 ID NAME SALARY AGE 102 AJAY 5000 35 105 JOHN 5000 36 108 SUNIL 3500 33
  • 9. PROJECTION EMPLOYEE RESULTING TABLES A. π ID (EMPLOYEE) B. π NAME,AGE (EMPLOYEE) B A ID NAME SALARY AGE 101 AMIT 4500 30 102 AJAY 5000 35 105 JOHN 5000 36 106 ABHI 4000 28 107 ALI 4800 31 108 SUNIL 3500 33 109 JOHN 4600 29 NAME AGE AMIT 30 AJAY 35 JOHN 36 ABHI 28 ALI 31 SUNIL 33 JOHN 29 ID 101 102 105 106 107 108 109
  • 10. COURSE(C) S JOIN RESULTING TABLE( EQUI-JOIN ) COURSE=C_ID (C) STU(S) ROLL.NO NAME COURSE 101 PIYUSH M-01 102 SUMIT M-02 103 SHEENA M-04 104 RITU M-03 C_ID C_NAME C_DUR M-01 MBA(HR) 2 M-02 MSC(PHY) 2 M-03 MSC(IT) 2 M-04 MCA 3 ROLL.NO NAME COURSE 101 PIYUSH M-01 102 SUMIT M-02 103 SHEENA M-04 104 RITU M-03 C_ID C_NAME C_DUR M-01 MBA(HR) 2 M-02 MSC(PHY) 2 M-04 MCA 3 M-03 MSC(IT) 2
  • 11. COURSE(C) NATURAL JOIN ON S AND C NATURAL JOIN(INNER JOIN) STU(S) ROLL.NO NAME COURSE 101 PIYUSH M-01 102 SUMIT M-02 103 SHEENA M-04 104 RITU M-03 C_NAME C_DUR MBA(HR) 2 MSC(PHY) 2 MCA 3 MSC(IT) 2 ROLL.NO NAME COURSE 101 PIYUSH M-01 102 SUMIT M-02 103 SHEENA M-04 104 RITU M-03 C_ID C_NAME C_DUR M-01 MBA(HR) 2 M-02 MSC(PHY) 2 M-03 MSC(IT) 2 M-04 MCA 3
  • 12. DIVISION MAIN R1 SUB2 SUB3 RESULTING TABLES R3 R3  MAIN ÷ SUB3 R2 R1  MAIN ÷ SUB1 R2  MAIN ÷ SUB2 SUB1 ASSIGNMENT A B A1 B1 A3 B2 A2 B3 A2 B1 A1 B3 A3 B3 A3 B1 B B1 B3 B B2 B B2 B3 A A1 A2 A3 A A3 A A3
  • 13.
  • 14.
  • 15. Aggregate functions and grouping (R) COUNT EMP_ID, SUM SALARY £ (R) DEP_ID £ COUNT EMP_ID, MAXIMUM SALARY (R) EMP_ID NAME DEP_ID SALARY 250 RAVI 10 5600 251 ANUJ 11 4000 252 JOHN 13 10000 253 AJIT 10 4500 254 RAVI 13 9000 256 AJAY 11 5000 257 ANUJ 11 3000 258 JOHN 10 2000 DEP_ID COUNT EMP_ID SUM SALARY 10 3 12100 11 3 12000 13 2 19000 COUNT EMP_ID MAX SALARY 9 10000
  • 16.
  • 17. LEFT OUTER JOIN EMP(E) DEPT(D) E D EMP_ID E_NAME AGE DEP_NO 101 AJAY 28 10 103 AMIT 33 11 104 PIYUSH 30 10 107 AJIT 23 NULL DEP_ID D_NAME 10 CREDIT 11 LOAN 12 CASH EMP_ID E_NAME AGE D_NAME 101 AJAY 28 CREDIT 103 AMIT 33 LOAN 104 PIYUSH 30 CREDIT 107 AJIT 23 NULL
  • 18. RIGHT OUTER JOIN EMP(E) DEPT(D) E D DEP_ID D_NAME 10 CREDIT 11 LOAN 12 CASH EMP_ID E_NAME AGE DEP_NO 101 AJAY 28 10 103 AMIT 33 11 104 PIYUSH 30 10 107 AJIT 23 NULL EMP_ID E_NAME AGE D_NAME 101 AJAY 28 CREDIT 103 AMIT 33 LOAN 104 PIYUSH 30 CREDIT NULL NULL NULL CASH
  • 19. FULL OUTER JOIN EMP(E) DEPT(D) E D DEP_ID D_NAME 10 CREDIT 11 LOAN 12 CASH EMP_ID E_NAME AGE DEP_NO 101 AJAY 28 10 103 AMIT 33 11 104 PIYUSH 30 10 107 AJIT 23 NULL EMP_ID E_NAME AGE D_NAME 101 AJAY 28 CREDIT 103 AMIT 33 LOAN 104 PIYUSH 30 CREDIT 107 AJIT 23 NULL NULL NULL NULL CASH