SlideShare a Scribd company logo
1 of 12
Extended Relational-Algebra-Operations 
 Generalized Projection 
 Outer Join 
 Aggregate Functions 
Generalized Projection 
 Extends the projection operation by allowing arithmetic functions 
to be used in the projection list. 
 F1, F2, …, Fn(E) 
 E is any relational-algebra expression 
 Each of F1, F2, …, Fn are are arithmetic expressions involving 
constants and attributes in the schema of E. 
 Given relation credit-info(customer-name, limit, credit-balance), 
find how much more each person can spend: 
customer-name, limit – credit-balance (credit-info) 
Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. 
Database System Concepts 3.1 ©Silberschatz, Korth and Sudarshan
Aggregate Functions and Operations 
 Aggregation function takes a collection of values and returns a 
single value as a result. 
avg: average value 
min: minimum value 
max: maximum value 
sum: sum of values 
count: number of values 
 Aggregate operation in relational algebra 
G1, G2, …, Gng F1( A1), F2( A2),…, Fn( An) (E) 
 E is any relational-algebra expression 
 G1, G2 …, Gn is a list of attributes on which to group (can be empty) 
 Each Fi is an aggregate function 
 Each Ai is an attribute name 
Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. 
Database System Concepts 3.2 ©Silberschatz, Korth and Sudarshan
Aggregate Operation – Example 
 Relation r: 
A B 
 
 
 
 
 
 
 
 
C 
7 
7 
3 
10 
g sum(c) (r) 
sum-C 
27 
Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. 
Database System Concepts 3.3 ©Silberschatz, Korth and Sudarshan
Aggregate Operation – Example 
 Relation account grouped by branch-name: 
branch-name account-number balance 
Perryridge 
A-102 
Perryridge 
A-201 
Brighton 
A-217 
Brighton 
A-215 
Redwood 
A-222 
branch-name g sum(balance) (account) 
400 
900 
750 
750 
700 
branch-name balance 
Perryridge 
1300 
Brighton 
1500 
Redwood 
700 
Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. 
Database System Concepts 3.4 ©Silberschatz, Korth and Sudarshan
Outer Join 
 An extension of the join operation that avoids loss of 
information. 
 Computes the join and then adds tuples form one 
relation that does not match tuples in the other 
relation to the result of the join. 
 Uses null values: 
 null signifies that the value is unknown or does not exist 
 All comparisons involving null are (roughly speaking) false by 
definition. 
Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. 
Database System Concepts 3.5 ©Silberschatz, Korth and Sudarshan
Outer Join – Example 
 Relation loan 
branch-name 
Downtown 
Redwood 
Perryridge 
loan-number amount 
L-170 
L-230 
L-260 
 Relation borrower 
3000 
4000 
1700 
customer-name loan-number 
Jones 
L-170 
Smith 
L-230 
Hayes 
L-155 
Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. 
Database System Concepts 3.6 ©Silberschatz, Korth and Sudarshan
Outer Join – Example 
 Inner Join 
loan Borrower 
loan-number amount 
L-170 
3000 
L-230 
4000 
customer-name 
Jones 
Smith 
branch-name 
Downtown 
Redwood 
 Left Outer Join 
loan Borrower 
branch-name customer-name 
Downtown 
Jones 
Redwood 
Smith 
Perryridge 
null 
loan-number amount 
L-170 
3000 
L-230 
4000 
L-260 
1700 
Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. 
Database System Concepts 3.7 ©Silberschatz, Korth and Sudarshan
Outer Join – Example 
 Right Outer Join 
loan borrower 
loan-number amount 
L-170 
L-230 
L-155 
 Full Outer Join 
branch-name 
Downtown 
Redwood 
null 
loan borrower 
3000 
4000 
null 
customer-name 
Jones 
Smith 
Hayes 
loan-number amount 
L-170 
3000 
L-230 
4000 
L-260 
1700 
L-155 
null 
customer-name 
Jones 
Smith 
null 
Hayes 
branch-name 
Downtown 
Redwood 
Perryridge 
null 
Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. 
Database System Concepts 3.8 ©Silberschatz, Korth and Sudarshan
Modification of the Database 
 The content of the database may be modified using the following 
operations: 
 Deletion 
 Insertion 
 Updating 
 All these operations are expressed using the assignment 
operator. 
Deletion 
 A delete request is expressed similarly to a query, except instead 
of displaying tuples to the user, the selected tuples are removed 
from the database. 
 Can delete only whole tuples; cannot delete values on only 
particular attributes 
 A deletion is expressed in relational algebra by: 
r  r – E 
where r is a relation and E is a relational algebra query. 
Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. 
Database System Concepts 3.9 ©Silberschatz, Korth and Sudarshan
Deletion Examples 
 Delete all account records in the Perryridge branch. 
account  account – branch-name = “Perryridge” (account) 
Delete all loan records with amount in the range of 0 to 50 
loan  loan –  amount 0 and amount  50 (loan) 
Delete all accounts at branches located in Needham. 
r1   branch-city = “Needham” (account branch) 
r2  branch-name, account-number, balance (r1) 
r3   customer-name, account-number (r2 depositor) 
account  account – r2 
depositor  depositor – r3 
Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. 
Database System Concepts 3.10 ©Silberschatz, Korth and Sudarshan
Insertion 
 To insert data into a relation, we either: 
 specify a tuple to be inserted 
 write a query whose result is a set of tuples to be inserted 
 in relational algebra, an insertion is expressed by: 
r  r  E 
where r is a relation and E is a relational algebra expression. 
 The insertion of a single tuple is expressed by letting E be a 
constant relation containing one tuple. 
Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. 
Database System Concepts 3.11 ©Silberschatz, Korth and Sudarshan
Insertion Examples 
 Insert information in the database specifying that Smith has 
$1200 in account A-973 at the Perryridge branch. 
account  account  {(“Perryridge”, A-973, 1200)} 
depositor  depositor  {(“Smith”, A-973)} 
 Provide as a gift for all loan customers in the Perryridge 
branch, a $200 savings account. Let the loan number serve 
as the account number for the new savings account. 
r1  (branch-name = “Perryridge” (borrower loan)) 
account  account  branch-name, account-number,200 (r1) 
depositor  depositor  customer-name, loan-number(r1) 
Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. 
Database System Concepts 3.12 ©Silberschatz, Korth and Sudarshan

More Related Content

What's hot

Enhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) ModelingEnhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) Modelingsontumax
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalizationdaxesh chauhan
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model IntroductionNishant Munjal
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbmsshekhar1991
 
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationDbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationBIT Durg
 
Relational Algebra & Calculus
Relational Algebra & CalculusRelational Algebra & Calculus
Relational Algebra & CalculusAbdullah Khosa
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational modelChirag vasava
 
Presentation on dbms(relational calculus)
Presentation on dbms(relational calculus)Presentation on dbms(relational calculus)
Presentation on dbms(relational calculus)yourbookworldanil
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMSkoolkampus
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLEVraj Patel
 
Multivalued dependency
Multivalued dependencyMultivalued dependency
Multivalued dependencyavniS
 
Characteristic of dabase approach
Characteristic of dabase approachCharacteristic of dabase approach
Characteristic of dabase approachLuina Pani
 
Database abstraction
Database abstractionDatabase abstraction
Database abstractionRituBhargava7
 
SQL, Embedded SQL, Dynamic SQL and SQLJ
SQL, Embedded SQL, Dynamic SQL and SQLJSQL, Embedded SQL, Dynamic SQL and SQLJ
SQL, Embedded SQL, Dynamic SQL and SQLJDharita Chokshi
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization Hafiz faiz
 

What's hot (20)

Enhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) ModelingEnhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) Modeling
 
Basic DBMS ppt
Basic DBMS pptBasic DBMS ppt
Basic DBMS ppt
 
Relational model
Relational modelRelational model
Relational model
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalization
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationDbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
 
Relational Algebra & Calculus
Relational Algebra & CalculusRelational Algebra & Calculus
Relational Algebra & Calculus
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
Presentation on dbms(relational calculus)
Presentation on dbms(relational calculus)Presentation on dbms(relational calculus)
Presentation on dbms(relational calculus)
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
Multivalued dependency
Multivalued dependencyMultivalued dependency
Multivalued dependency
 
Characteristic of dabase approach
Characteristic of dabase approachCharacteristic of dabase approach
Characteristic of dabase approach
 
Database abstraction
Database abstractionDatabase abstraction
Database abstraction
 
SQL, Embedded SQL, Dynamic SQL and SQLJ
SQL, Embedded SQL, Dynamic SQL and SQLJSQL, Embedded SQL, Dynamic SQL and SQLJ
SQL, Embedded SQL, Dynamic SQL and SQLJ
 
Temporal databases
Temporal databasesTemporal databases
Temporal databases
 
ER-Model-ER Diagram
ER-Model-ER DiagramER-Model-ER Diagram
ER-Model-ER Diagram
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization
 

Similar to Extended relational algebra

Similar to Extended relational algebra (20)

Ch3 a
Ch3 aCh3 a
Ch3 a
 
Ch3
Ch3Ch3
Ch3
 
relational algebra and calculus queries .ppt
relational algebra and calculus queries .pptrelational algebra and calculus queries .ppt
relational algebra and calculus queries .ppt
 
Lecture_W9_Normalization.ppt
Lecture_W9_Normalization.pptLecture_W9_Normalization.ppt
Lecture_W9_Normalization.ppt
 
Ch14
Ch14Ch14
Ch14
 
Database System Concepts ch4.pdf
Database System Concepts ch4.pdfDatabase System Concepts ch4.pdf
Database System Concepts ch4.pdf
 
Intro to Relational Model
Intro to Relational ModelIntro to Relational Model
Intro to Relational Model
 
Ch7
Ch7Ch7
Ch7
 
ch3[1].ppt
ch3[1].pptch3[1].ppt
ch3[1].ppt
 
DBMS _Relational model
DBMS _Relational modelDBMS _Relational model
DBMS _Relational model
 
Ch7
Ch7Ch7
Ch7
 
Database
DatabaseDatabase
Database
 
Ch4
Ch4Ch4
Ch4
 
Ch3
Ch3Ch3
Ch3
 
Sql.pptx
Sql.pptxSql.pptx
Sql.pptx
 
Relational Algebra and relational queries .ppt
Relational Algebra and relational queries .pptRelational Algebra and relational queries .ppt
Relational Algebra and relational queries .ppt
 
Relational algebra operations
Relational algebra operationsRelational algebra operations
Relational algebra operations
 
U2_ER_modeling.pptx
U2_ER_modeling.pptxU2_ER_modeling.pptx
U2_ER_modeling.pptx
 
jhbuhbhujnhyubhbuybuybuybbuhyybuybuybuybybyubyubybybb
jhbuhbhujnhyubhbuybuybuybbuhyybuybuybuybybyubyubybybbjhbuhbhujnhyubhbuybuybuybbuhyybuybuybuybybyubyubybybb
jhbuhbhujnhyubhbuybuybuybbuhyybuybuybuybybyubyubybybb
 
ch2.ppt
ch2.pptch2.ppt
ch2.ppt
 

More from 1Arun_Pandey

Sorfware engineering presentation (software testing)
Sorfware engineering presentation (software testing)Sorfware engineering presentation (software testing)
Sorfware engineering presentation (software testing)1Arun_Pandey
 
Database architecture
Database architectureDatabase architecture
Database architecture1Arun_Pandey
 
Data communication principle
Data communication  principleData communication  principle
Data communication principle1Arun_Pandey
 
Project on Hotel Management System
Project on Hotel Management SystemProject on Hotel Management System
Project on Hotel Management System1Arun_Pandey
 

More from 1Arun_Pandey (7)

Sorfware engineering presentation (software testing)
Sorfware engineering presentation (software testing)Sorfware engineering presentation (software testing)
Sorfware engineering presentation (software testing)
 
DISTRIBUTION
DISTRIBUTIONDISTRIBUTION
DISTRIBUTION
 
Java solution
Java solutionJava solution
Java solution
 
Database architecture
Database architectureDatabase architecture
Database architecture
 
Planning
Planning Planning
Planning
 
Data communication principle
Data communication  principleData communication  principle
Data communication principle
 
Project on Hotel Management System
Project on Hotel Management SystemProject on Hotel Management System
Project on Hotel Management System
 

Recently uploaded

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
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
 
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
 
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
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
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 SectorsAssociation for Project Management
 
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
 
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
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
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
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
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
 
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
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 

Recently uploaded (20)

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
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
 
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
 
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
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
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
 
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...
 
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
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
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
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
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
 
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
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 

Extended relational algebra

  • 1. Extended Relational-Algebra-Operations  Generalized Projection  Outer Join  Aggregate Functions Generalized Projection  Extends the projection operation by allowing arithmetic functions to be used in the projection list.  F1, F2, …, Fn(E)  E is any relational-algebra expression  Each of F1, F2, …, Fn are are arithmetic expressions involving constants and attributes in the schema of E.  Given relation credit-info(customer-name, limit, credit-balance), find how much more each person can spend: customer-name, limit – credit-balance (credit-info) Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. Database System Concepts 3.1 ©Silberschatz, Korth and Sudarshan
  • 2. Aggregate Functions and Operations  Aggregation function takes a collection of values and returns a single value as a result. avg: average value min: minimum value max: maximum value sum: sum of values count: number of values  Aggregate operation in relational algebra G1, G2, …, Gng F1( A1), F2( A2),…, Fn( An) (E)  E is any relational-algebra expression  G1, G2 …, Gn is a list of attributes on which to group (can be empty)  Each Fi is an aggregate function  Each Ai is an attribute name Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. Database System Concepts 3.2 ©Silberschatz, Korth and Sudarshan
  • 3. Aggregate Operation – Example  Relation r: A B         C 7 7 3 10 g sum(c) (r) sum-C 27 Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. Database System Concepts 3.3 ©Silberschatz, Korth and Sudarshan
  • 4. Aggregate Operation – Example  Relation account grouped by branch-name: branch-name account-number balance Perryridge A-102 Perryridge A-201 Brighton A-217 Brighton A-215 Redwood A-222 branch-name g sum(balance) (account) 400 900 750 750 700 branch-name balance Perryridge 1300 Brighton 1500 Redwood 700 Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. Database System Concepts 3.4 ©Silberschatz, Korth and Sudarshan
  • 5. Outer Join  An extension of the join operation that avoids loss of information.  Computes the join and then adds tuples form one relation that does not match tuples in the other relation to the result of the join.  Uses null values:  null signifies that the value is unknown or does not exist  All comparisons involving null are (roughly speaking) false by definition. Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. Database System Concepts 3.5 ©Silberschatz, Korth and Sudarshan
  • 6. Outer Join – Example  Relation loan branch-name Downtown Redwood Perryridge loan-number amount L-170 L-230 L-260  Relation borrower 3000 4000 1700 customer-name loan-number Jones L-170 Smith L-230 Hayes L-155 Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. Database System Concepts 3.6 ©Silberschatz, Korth and Sudarshan
  • 7. Outer Join – Example  Inner Join loan Borrower loan-number amount L-170 3000 L-230 4000 customer-name Jones Smith branch-name Downtown Redwood  Left Outer Join loan Borrower branch-name customer-name Downtown Jones Redwood Smith Perryridge null loan-number amount L-170 3000 L-230 4000 L-260 1700 Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. Database System Concepts 3.7 ©Silberschatz, Korth and Sudarshan
  • 8. Outer Join – Example  Right Outer Join loan borrower loan-number amount L-170 L-230 L-155  Full Outer Join branch-name Downtown Redwood null loan borrower 3000 4000 null customer-name Jones Smith Hayes loan-number amount L-170 3000 L-230 4000 L-260 1700 L-155 null customer-name Jones Smith null Hayes branch-name Downtown Redwood Perryridge null Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. Database System Concepts 3.8 ©Silberschatz, Korth and Sudarshan
  • 9. Modification of the Database  The content of the database may be modified using the following operations:  Deletion  Insertion  Updating  All these operations are expressed using the assignment operator. Deletion  A delete request is expressed similarly to a query, except instead of displaying tuples to the user, the selected tuples are removed from the database.  Can delete only whole tuples; cannot delete values on only particular attributes  A deletion is expressed in relational algebra by: r  r – E where r is a relation and E is a relational algebra query. Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. Database System Concepts 3.9 ©Silberschatz, Korth and Sudarshan
  • 10. Deletion Examples  Delete all account records in the Perryridge branch. account  account – branch-name = “Perryridge” (account) Delete all loan records with amount in the range of 0 to 50 loan  loan –  amount 0 and amount  50 (loan) Delete all accounts at branches located in Needham. r1   branch-city = “Needham” (account branch) r2  branch-name, account-number, balance (r1) r3   customer-name, account-number (r2 depositor) account  account – r2 depositor  depositor – r3 Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. Database System Concepts 3.10 ©Silberschatz, Korth and Sudarshan
  • 11. Insertion  To insert data into a relation, we either:  specify a tuple to be inserted  write a query whose result is a set of tuples to be inserted  in relational algebra, an insertion is expressed by: r  r  E where r is a relation and E is a relational algebra expression.  The insertion of a single tuple is expressed by letting E be a constant relation containing one tuple. Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. Database System Concepts 3.11 ©Silberschatz, Korth and Sudarshan
  • 12. Insertion Examples  Insert information in the database specifying that Smith has $1200 in account A-973 at the Perryridge branch. account  account  {(“Perryridge”, A-973, 1200)} depositor  depositor  {(“Smith”, A-973)}  Provide as a gift for all loan customers in the Perryridge branch, a $200 savings account. Let the loan number serve as the account number for the new savings account. r1  (branch-name = “Perryridge” (borrower loan)) account  account  branch-name, account-number,200 (r1) depositor  depositor  customer-name, loan-number(r1) Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur. Database System Concepts 3.12 ©Silberschatz, Korth and Sudarshan