Jennifer Widom
Relational Databases
Relational Algebra (1)
Select, project, join
Jennifer Widom
Relational Algebra (1)
Query (expression) on set of relations produces
relation as a result
Jennifer Widom
Relational Algebra (1)
Examples: simple college admissions database
College(cName,state,enrollment)
Student(sID,sName,GPA,sizeHS)
Apply(sID,cName,major,decision)
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Jennifer Widom
Simplest query: relation name
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (1)
Use operators to filter, slice, combine
Jennifer Widom
Select operator: picks certain rows
Students with GPA>3.7
Students with GPA>3.7 and HS<1000
Applications to Stanford CS major
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (1)
Jennifer Widom
Project operator: picks certain columns
ID and decision of all applications
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (1)
Jennifer Widom
To pick both rows and columns…
ID and name of students with GPA>3.7
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (1)
Jennifer Widom
Duplicates
List of application majors and decisions
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (1)
Jennifer Widom
Cross-product: combine two relations
(a.k.a. Cartesian product)
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (1)
Jennifer Widom
Cross-product: combine two relations
(a.k.a. Cartesian product)
Names and GPAs of students with HS>1000 who applied to CS
and were rejected
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (1)
Jennifer Widom
Natural Join
 Enforce equality on all attributes with same name
 Eliminate one copy of duplicate attributes
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (1)
Jennifer Widom
Natural Join
Names and GPAs of students with HS>1000 who applied to CS
and were rejected
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (1)
Names and GPAs of students with HS>1000 who applied to CS
at college with enr>20,000 and were rejected
Jennifer Widom
Natural Join
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (1)
Jennifer Widom
Theta Join
 Basic operation implemented in DBMS
 Term “join” often means theta join
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (1)
Jennifer Widom
Relational Algebra (1)
Query (expression) on set of relations produces
relation as a result
 Simplest query: relation name
 Use operators to filter, slice, combine
 Operators so far: select, project, cross-product,
natural join, theta join

More Related Content

PPTX
Commands
PPT
Sql Authorization
PPT
MYSQL Aggregate Functions
PPTX
Nitish 007
PPT
DBMS : Relational Algebra
PPTX
Dbms and rdbms
PDF
From crash to testcase
PPS
Database system-DBMS
Commands
Sql Authorization
MYSQL Aggregate Functions
Nitish 007
DBMS : Relational Algebra
Dbms and rdbms
From crash to testcase
Database system-DBMS

Viewers also liked (20)

PPTX
Data integrity Dbms presentation 12 cs 18
PPTX
Characteristic of dabase approach
PDF
Nested Queries Lecture
PPTX
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
PDF
3 data modeling using the entity-relationship (er) model
PPTX
Data model and entity relationship
PPT
Data manipulation instructions
PPTX
Database , 8 Query Optimization
PPT
Dbms ii mca-ch5-ch6-relational algebra-2013
PPTX
SQL Data Manipulation
PDF
Enhanced Entity-Relationship (EER) Modeling
PPTX
T-SQL Overview
PPTX
trigger dbms
PPT
SQL Views
PPTX
PPT
Er & eer to relational mapping
ODP
ER Model in DBMS
PPTX
Advanced DBMS presentation
PPTX
Acid properties
PDF
Overview of security in DBMS
Data integrity Dbms presentation 12 cs 18
Characteristic of dabase approach
Nested Queries Lecture
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
3 data modeling using the entity-relationship (er) model
Data model and entity relationship
Data manipulation instructions
Database , 8 Query Optimization
Dbms ii mca-ch5-ch6-relational algebra-2013
SQL Data Manipulation
Enhanced Entity-Relationship (EER) Modeling
T-SQL Overview
trigger dbms
SQL Views
Er & eer to relational mapping
ER Model in DBMS
Advanced DBMS presentation
Acid properties
Overview of security in DBMS
Ad

Similar to Relational algebra1 (20)

PPT
R Algebra.ppt
PPTX
Relational_Algebra Database management system
PPT
Relational_Intro_1. relational databaseppt
PPT
databases_an data connection_computers(2).ppt
PPT
Relational_Intro_1.ppt
PPT
jklllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll...
PPT
Relational_Database_managementsystem.ppt
PPT
Relational database management Introduction.ppt
PPT
Introduction to Relational Databases ___
PPTX
Database managment System Relational Algebra
PPT
Ch7
PPTX
Relational Algebra in Database Systems.pptx
PPT
Rdbms (2)
PPTX
Introduction to Relational Database Management Systems
PDF
RDBMS Algebra
PPT
Mca ii-dbms- u-iii-sql concepts
PPTX
Lecture-3 Relational Algebra I.pptx
PPTX
Relational Algebra and it's Operations pptx
PPT
chapter 5-Relational Algebra and calculus.ppt
PPTX
Relational Model
R Algebra.ppt
Relational_Algebra Database management system
Relational_Intro_1. relational databaseppt
databases_an data connection_computers(2).ppt
Relational_Intro_1.ppt
jklllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll...
Relational_Database_managementsystem.ppt
Relational database management Introduction.ppt
Introduction to Relational Databases ___
Database managment System Relational Algebra
Ch7
Relational Algebra in Database Systems.pptx
Rdbms (2)
Introduction to Relational Database Management Systems
RDBMS Algebra
Mca ii-dbms- u-iii-sql concepts
Lecture-3 Relational Algebra I.pptx
Relational Algebra and it's Operations pptx
chapter 5-Relational Algebra and calculus.ppt
Relational Model
Ad

More from Tianlu Wang (20)

PDF
L7 er2
PDF
L8 design1
PDF
L9 design2
PDF
14 pro resolution
PDF
13 propositional calculus
PDF
12 adversal search
PDF
11 alternative search
PDF
10 2 sum
PDF
22 planning
PDF
21 situation calculus
PDF
20 bayes learning
PDF
19 uncertain evidence
PDF
18 common knowledge
PDF
17 2 expert systems
PDF
17 1 knowledge-based system
PDF
16 2 predicate resolution
PDF
16 1 predicate resolution
PDF
15 predicate
PDF
09 heuristic search
PDF
08 uninformed search
L7 er2
L8 design1
L9 design2
14 pro resolution
13 propositional calculus
12 adversal search
11 alternative search
10 2 sum
22 planning
21 situation calculus
20 bayes learning
19 uncertain evidence
18 common knowledge
17 2 expert systems
17 1 knowledge-based system
16 2 predicate resolution
16 1 predicate resolution
15 predicate
09 heuristic search
08 uninformed search

Recently uploaded (20)

PPTX
668819271-A Relibility CCEPTANCE-SAMPLING.pptx
PDF
INSEAD_Executive_Education_At-A-Glance.pdf
PPTX
Nationalism in India Ch-2.pptx ssssss classs 10
PPTX
SlideEgg_85447-Sneaker PowerPoint Template Free.pptx
PPTX
National_Artists_for_Dance_with_Examples-1.pptx
PPTX
Indian Knowledge System . More information in the Indiaa
PPTX
arts-history-and-development-week-7.1.pptx
PPTX
PPT 1 - Preamble - SPI PPT 2024.bfghfghfhfhfghfggfdgd
PDF
15901922083_PQA.pdf................................
PPTX
ST-05 final ppt.pptxbjbvcdiuchiudhciuhdiudhexiuh
PPTX
CMU-WEEK-2_TOPIC_Photography_Its_Definition_Historical_Background_and_Princi ...
PPTX
community ophthalmology jwuhwwj usuhwhushhwyw
PPT
History of Photography: Advent of color and Digital1951_to_present.ppt
PDF
Annah la Javanaise_ The Truth Behind Gauguin’s Model.pdf
PPTX
LESSON 2 PUBLIC SPEAKING IS VERY FUN I LOVE IT
PPTX
IOT Unit 6 PPT ( ~ By Prof. Simran Ahuja ).pptx
PPT
Photography History: The Beginning1901-1950.ppt
PPTX
level measurement foe tttttttttttttttttttttttttttttttttt
PPTX
Slides-Archival-Moment-FGCCT-6Feb23.pptx
PPTX
File Utama WEEKLY 16 Mei - 22 Mei 2025 .pptx
668819271-A Relibility CCEPTANCE-SAMPLING.pptx
INSEAD_Executive_Education_At-A-Glance.pdf
Nationalism in India Ch-2.pptx ssssss classs 10
SlideEgg_85447-Sneaker PowerPoint Template Free.pptx
National_Artists_for_Dance_with_Examples-1.pptx
Indian Knowledge System . More information in the Indiaa
arts-history-and-development-week-7.1.pptx
PPT 1 - Preamble - SPI PPT 2024.bfghfghfhfhfghfggfdgd
15901922083_PQA.pdf................................
ST-05 final ppt.pptxbjbvcdiuchiudhciuhdiudhexiuh
CMU-WEEK-2_TOPIC_Photography_Its_Definition_Historical_Background_and_Princi ...
community ophthalmology jwuhwwj usuhwhushhwyw
History of Photography: Advent of color and Digital1951_to_present.ppt
Annah la Javanaise_ The Truth Behind Gauguin’s Model.pdf
LESSON 2 PUBLIC SPEAKING IS VERY FUN I LOVE IT
IOT Unit 6 PPT ( ~ By Prof. Simran Ahuja ).pptx
Photography History: The Beginning1901-1950.ppt
level measurement foe tttttttttttttttttttttttttttttttttt
Slides-Archival-Moment-FGCCT-6Feb23.pptx
File Utama WEEKLY 16 Mei - 22 Mei 2025 .pptx

Relational algebra1

  • 1. Jennifer Widom Relational Databases Relational Algebra (1) Select, project, join
  • 2. Jennifer Widom Relational Algebra (1) Query (expression) on set of relations produces relation as a result
  • 3. Jennifer Widom Relational Algebra (1) Examples: simple college admissions database College(cName,state,enrollment) Student(sID,sName,GPA,sizeHS) Apply(sID,cName,major,decision) cName state enr sID sName GPA HS sID cName major dec College Student Apply
  • 4. Jennifer Widom Simplest query: relation name cName state enr sID sName GPA HS sID cName major dec College Student Apply Relational Algebra (1) Use operators to filter, slice, combine
  • 5. Jennifer Widom Select operator: picks certain rows Students with GPA>3.7 Students with GPA>3.7 and HS<1000 Applications to Stanford CS major cName state enr sID sName GPA HS sID cName major dec College Student Apply Relational Algebra (1)
  • 6. Jennifer Widom Project operator: picks certain columns ID and decision of all applications cName state enr sID sName GPA HS sID cName major dec College Student Apply Relational Algebra (1)
  • 7. Jennifer Widom To pick both rows and columns… ID and name of students with GPA>3.7 cName state enr sID sName GPA HS sID cName major dec College Student Apply Relational Algebra (1)
  • 8. Jennifer Widom Duplicates List of application majors and decisions cName state enr sID sName GPA HS sID cName major dec College Student Apply Relational Algebra (1)
  • 9. Jennifer Widom Cross-product: combine two relations (a.k.a. Cartesian product) cName state enr sID sName GPA HS sID cName major dec College Student Apply Relational Algebra (1)
  • 10. Jennifer Widom Cross-product: combine two relations (a.k.a. Cartesian product) Names and GPAs of students with HS>1000 who applied to CS and were rejected cName state enr sID sName GPA HS sID cName major dec College Student Apply Relational Algebra (1)
  • 11. Jennifer Widom Natural Join  Enforce equality on all attributes with same name  Eliminate one copy of duplicate attributes cName state enr sID sName GPA HS sID cName major dec College Student Apply Relational Algebra (1)
  • 12. Jennifer Widom Natural Join Names and GPAs of students with HS>1000 who applied to CS and were rejected cName state enr sID sName GPA HS sID cName major dec College Student Apply Relational Algebra (1) Names and GPAs of students with HS>1000 who applied to CS at college with enr>20,000 and were rejected
  • 13. Jennifer Widom Natural Join cName state enr sID sName GPA HS sID cName major dec College Student Apply Relational Algebra (1)
  • 14. Jennifer Widom Theta Join  Basic operation implemented in DBMS  Term “join” often means theta join cName state enr sID sName GPA HS sID cName major dec College Student Apply Relational Algebra (1)
  • 15. Jennifer Widom Relational Algebra (1) Query (expression) on set of relations produces relation as a result  Simplest query: relation name  Use operators to filter, slice, combine  Operators so far: select, project, cross-product, natural join, theta join