relational algebra - suanlabsuanlab.com/assets/lectures/dbe/03.pdfrelational algebra select,...
TRANSCRIPT
Relational Algebraselect, project, join, set operators, renaming, notation
Suan Lee
• Query (expression) on set of relations produces relation as a result
Relational Algebra - Suan Lee 2
• Query (expression) on set of relations produces relation as a result
Relational Algebra - Suan Lee 3
Q1
Examples: simple college admissions database
College(cName, state, enrollment)
Student(sID, sName, GPA, sizeHS)
Apply(sID, cName, major, decision)
Relational Algebra - Suan Lee 4
Examples: simple college admissions database
College(cName, state, enrollment)
Student(sID, sName, GPA, sizeHS)
Apply(sID, cName, major, decision)
Relational Algebra - Suan Lee 5
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Simplest query: relation name
Use operators to filter, slice, combine
Relational Algebra - Suan Lee 6
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Select operator: picks certain rowsStudents with GPA>3.7
Students with GPA>3.7 and HS<1000
Applications to Stanford CS major
Relational Algebra - Suan Lee 7
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Select operator: picks certain rowsStudents with GPA>3.7
σGPA>3.7 Student
Students with GPA>3.7 and HS<1000
Applications to Stanford CS major
Relational Algebra - Suan Lee 8
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Select operator: picks certain rowsStudents with GPA>3.7
σGPA>3.7 Student
Students with GPA>3.7 and HS<1000σGPA>3.7 ∧ HS<1000 Student
Applications to Stanford CS major
Relational Algebra - Suan Lee 9
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Select operator: picks certain rowsStudents with GPA>3.7
σGPA>3.7 Student
Students with GPA>3.7 and HS<1000σGPA>3.7 ∧ HS<1000 Student
Applications to Stanford CS majorσcName=‘Stanford’ ∧major=‘cs’ Apply
Relational Algebra - Suan Lee 10
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Select operator: picks certain rowsStudents with GPA>3.7
σGPA>3.7 Student
Students with GPA>3.7 and HS<1000σGPA>3.7 ∧ HS<1000 Student
Applications to Stanford CS majorσcName=‘Stanford’ ∧major=‘cs’ Apply
Relational Algebra - Suan Lee 11
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
σcond Rel
Project operator: picks certain columns
ID and decision of all applications
Relational Algebra - Suan Lee 12
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Project operator: picks certain columns
ID and decision of all applications
ΠsID, decApply
Relational Algebra - Suan Lee 13
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
sID dec
Project operator: picks certain columns
ID and decision of all applications
ΠsID, decApply
ΠA1, A2, …, An
Relational Algebra - Suan Lee 14
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
sID dec
To pick both rows and columns…
ID and name of students with GPA>3.7
Relational Algebra - Suan Lee 15
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
To pick both rows and columns…
ID and name of students with GPA>3.7
ΠsID, sName(σGPA>3.7Student)
Relational Algebra - Suan Lee 16
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
To pick both rows and columns…
ID and name of students with GPA>3.7
ΠsID, sName(σGPA>3.7Student)
σcond(Expr)
ΠA1, A2, … An(Expr)
Relational Algebra - Suan Lee 17
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Duplicates
List of application majors and decisions
Relational Algebra - Suan Lee 18
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Duplicates
List of application majors and decisions
Πmajor, dec Apply
Relational Algebra - Suan Lee 19
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Duplicates
List of application majors and decisions
Πmajor, dec Apply
Relational Algebra - Suan Lee 20
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
SQL: multisets, bagsRelational Algebra: sets
Cross-product: combine two relations
(a.k.a. Cartesian product)
Relational Algebra - Suan Lee 21
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Cross-product: combine two relations
(a.k.a. Cartesian product)
Student × Apply
Relational Algebra - Suan Lee 22
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Cross-product: combine two relations
(a.k.a. Cartesian product)
Student × Apply
Relational Algebra - Suan Lee 23
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
×
Cross-product: combine two relations
(a.k.a. Cartesian product)
Student × Apply
Relational Algebra - Suan Lee 24
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
×
Student.sID Apply.sID
Cross-product: combine two relations
(a.k.a. Cartesian product)
Student × Apply
Relational Algebra - Suan Lee 25
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
×
Student.sID Apply.sID
S tuples A tuples
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
Relational Algebra - Suan Lee 26
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
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
(Student×Apply)
Relational Algebra - Suan Lee 27
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
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
σStudent.sID=Apply.sID (Student×Apply)
Relational Algebra - Suan Lee 28
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
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
σStudent.sID=Apply.sID∧HS>1000∧major=‘cs’ (Student×Apply)
Relational Algebra - Suan Lee 29
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
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
σStudent.sID=Apply.sID∧HS>1000∧major=‘cs’∧dec=‘R’ (Student×Apply)
Relational Algebra - Suan Lee 30
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
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
ΠsName, GPA (σStudent.sID=Apply.sID∧HS>1000∧major=‘cs’∧dec=‘R’ (Student×Apply))
Relational Algebra - Suan Lee 31
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Natural Join• Enforce equality on all attributes with same name
• Eliminate one copy of duplicate attributes
Relational Algebra - Suan Lee 32
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Natural Join• Enforce equality on all attributes with same name
• Eliminate one copy of duplicate attributes
Relational Algebra - Suan Lee 33
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Natural Join• Enforce equality on all attributes with same name
• Eliminate one copy of duplicate attributes
Relational Algebra - Suan Lee 34
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Natural Join• Enforce equality on all attributes with same name
• Eliminate one copy of duplicate attributes
Relational Algebra - Suan Lee 35
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Natural Join• Enforce equality on all attributes with same name
• Eliminate one copy of duplicate attributes
Relational Algebra - Suan Lee 36
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
⋈
Natural JoinNames and GPAs of students with HS>1000 who applied to CS
and were rejected
Relational Algebra - Suan Lee 37
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Natural JoinNames and GPAs of students with HS>1000 who applied to CS
and were rejected
(Student⋈Apply)
Relational Algebra - Suan Lee 38
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Natural JoinNames and GPAs of students with HS>1000 who applied to CS
and were rejected
ΠsName, GPA(σ HS>1000∧major=‘cs’∧dec=‘R’ (Student⋈Apply)
Relational Algebra - Suan Lee 39
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Natural JoinNames and GPAs of students with HS>1000 who applied to CS
at college with enr>20,000 and were rejected
ΠsName, GPA(σ HS>1000∧major=‘cs’∧dec=‘R’ (Student⋈Apply)
Relational Algebra - Suan Lee 40
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Natural JoinNames and GPAs of students with HS>1000 who applied to CS
at college with enr>20,000 and were rejected
ΠsName, GPA(σ HS>1000∧major=‘cs’∧dec=‘R’∧enr>20000(Student⋈(Apply⋈College))
Relational Algebra - Suan Lee 41
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Natural Join
Relational Algebra - Suan Lee 42
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Natural JoinExp1 ⋈ Exp2 ≡
Πschema(E1), schema(E2)(…)
σ E1A1=E2A1∧ E1A2=E2A2∧… (Exp1 × Exp2)
Relational Algebra - Suan Lee 43
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Theta Join
Relational Algebra - Suan Lee 44
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Theta Join
Exp1 ⋈ Exp2 ≡ σΘ(Exp1⋈ Exp2)
Relational Algebra - Suan Lee 45
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Theta Join
Exp1 ⋈ Exp2 ≡ σΘ(Exp1⋈ Exp2)
• Basic operation implemented in DBMS
• Term “join” often means theta join
Relational Algebra - Suan Lee 46
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
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
Relational Algebra - Suan Lee 47
Relational algebra query (expression) on set of relations produces relation as a result
College(cName, state, enrollment)
Student(sID, sName, GPA, sizeHS)
Apply(sID, cName, major, decision)
Relational Algebra - Suan Lee 48
Relational algebra query (expression) on set of relations produces relation as a result
College(cName, state, enrollment)
Student(sID, sName, GPA, sizeHS)
Apply(sID, cName, major, decision)
Relational Algebra - Suan Lee 49
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Union operator
List of college and student names
Relational Algebra - Suan Lee 50
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Union operator
List of college and student names
Relational Algebra - Suan Lee 51
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
StanfordSusan
CornellMaryJohn
…
Union operator
List of college and student names
Relational Algebra - Suan Lee 52
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
StanfordSusan
CornellMaryJohn
…
⋈× t1-t2
Union operator
List of college and student names
Relational Algebra - Suan Lee 53
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
StanfordSusan
CornellMaryJohn
…
⋈× t1-t2
t1
t2
Union operator
List of college and student names
Relational Algebra - Suan Lee 54
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
StanfordSusan
CornellMaryJohn
…
⋈× t1-t2
t1
t2
∪
Union operator
List of college and student names
Relational Algebra - Suan Lee 55
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
StanfordSusan
CornellMaryJohn
…
⋈× t1-t2
t1
t2
∪
ΠcNameCollege∪ΠsNameStudent
Difference operator
IDs of students who didn’t apply anywhere
Relational Algebra - Suan Lee 56
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Difference operator
IDs of students who didn’t apply anywhere
ΠsIDStudent-ΠsIDApply
Relational Algebra - Suan Lee 57
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Difference operator
IDs and names of students who didn’t apply anywhere
ΠsIDStudent-ΠsIDApply
Relational Algebra - Suan Lee 58
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Difference operator
IDs and names of students who didn’t apply anywhere
ΠsID, sNameStudent-ΠsID, ?Apply
Relational Algebra - Suan Lee 59
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Difference operator
IDs and names of students who didn’t apply anywhere
ΠsIDStudent-ΠsIDApply
Relational Algebra - Suan Lee 60
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Difference operator
IDs and names of students who didn’t apply anywhere
(ΠsIDStudent-ΠsIDApply)
Relational Algebra - Suan Lee 61
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Difference operator
IDs and names of students who didn’t apply anywhere
ΠsID, sName((ΠsIDStudent-ΠsIDApply)⋈Student)
Relational Algebra - Suan Lee 62
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Intersection operator
Names that are both a college name and a student name
Relational Algebra - Suan Lee 63
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Intersection operator
Names that are both a college name and a student name
ΠcNameCollege ∩ ΠsNameStudent
Relational Algebra - Suan Lee 64
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Intersection doesn’t add expressive power (1)
Relational Algebra - Suan Lee 65
Intersection doesn’t add expressive power (1)
E1 ∩ E2 ≡ E1-( E1-E2 )
Relational Algebra - Suan Lee 66
Intersection doesn’t add expressive power (1)
E1 ∩ E2 ≡ E1-( E1-E2 )
Relational Algebra - Suan Lee 67
E1 E2
Intersection doesn’t add expressive power (1)
E1 ∩ E2 ≡ E1-( E1-E2 )
Relational Algebra - Suan Lee 68
E1 E2
Intersection doesn’t add expressive power (1)
E1 ∩ E2 ≡ E1-( E1-E2 )
Relational Algebra - Suan Lee 69
E1 E2 E1 E2
-
Intersection doesn’t add expressive power (1)
E1 ∩ E2 ≡ E1-( E1-E2 )
Relational Algebra - Suan Lee 70
E1 E2 E1 E2
-E1 E2
≡
Intersection doesn’t add expressive power (2)
E1 ∩ E2 ≡ E1 ⋈ E2
Relational Algebra - Suan Lee 71
schema=
Rename operator
1.
2.
3.
Relational Algebra - Suan Lee 72
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Rename operator
1. ρR(A1, …, An)(E)
2.
3.
Relational Algebra - Suan Lee 73
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Rename operator
1. ρR(A1, …, An)(E)
2. ρR (E)
3. ρA1, …, An(E)
Relational Algebra - Suan Lee 74
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Rename operator
To unify schemas for set operators
List of college and student names
Relational Algebra - Suan Lee 75
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Rename operator
To unify schemas for set operators
List of college and student names
ΠcNameCollege∪ΠsNameStudent
Relational Algebra - Suan Lee 76
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Rename operator
To unify schemas for set operators
List of college and student names
ρC(name) (ΠcNameCollege)∪ρC(name) (ΠsNameStudent)
Relational Algebra - Suan Lee 77
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Rename operator
For disambiguation in “self-joins”
Pairs of colleges in same state
Relational Algebra - Suan Lee 78
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Rename operator
For disambiguation in “self-joins”
Pairs of colleges in same state
Relational Algebra - Suan Lee 79
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Stanford BerkeleyBerkeley UCLA
Rename operator
For disambiguation in “self-joins”
Pairs of colleges in same state
College×College
Relational Algebra - Suan Lee 80
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Rename operator
For disambiguation in “self-joins”
Pairs of colleges in same state
σstate=state(College×College)
Relational Algebra - Suan Lee 81
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Rename operator
For disambiguation in “self-joins”
Pairs of colleges in same state
Relational Algebra - Suan Lee 82
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Rename operator
For disambiguation in “self-joins”
Pairs of colleges in same state
ρc1(n1, s1, e1)(College)
Relational Algebra - Suan Lee 83
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Rename operator
For disambiguation in “self-joins”
Pairs of colleges in same state
ρc1(n1, s1, e1)(College) ρc2(n2, s2, e2)(College)
Relational Algebra - Suan Lee 84
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Rename operator
For disambiguation in “self-joins”
Pairs of colleges in same state
(ρc1(n1, s1, e1)(College)) × (ρc2(n2, s2, e2)(College))
Relational Algebra - Suan Lee 85
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Rename operator
For disambiguation in “self-joins”
Pairs of colleges in same state
σs1=s2((ρc1(n1, s1, e1)(College)) × (ρc2(n2, s2, e2)(College)))
Relational Algebra - Suan Lee 86
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Rename operator
For disambiguation in “self-joins”
Pairs of colleges in same state
(ρc1(n1, s1, e1)(College)) ⋈ (ρc2(n2, s2, e2)(College))
Relational Algebra - Suan Lee 87
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Rename operator
For disambiguation in “self-joins”
Pairs of colleges in same state
(ρc1(n1, s, e1)(College)) ⋈ (ρc2(n2, s, e2)(College))
Relational Algebra - Suan Lee 88
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Rename operator
For disambiguation in “self-joins”
Pairs of colleges in same state
(ρc1(n1, s, e1)(College)) ⋈ (ρc2(n2, s, e2)(College))
Relational Algebra - Suan Lee 89
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Stanford StanfordBerkeley BerkeleyStanford Berkeley
Rename operator
For disambiguation in “self-joins”
Pairs of colleges in same state
σn1≠n2(ρc1(n1, s, e1)(College)) ⋈ (ρc2(n2, s, e2)(College))
Relational Algebra - Suan Lee 90
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Stanford StanfordBerkeley BerkeleyStanford Berkeley
Rename operator
For disambiguation in “self-joins”
Pairs of colleges in same state
σn1≠n2(ρc1(n1, s, e1)(College)) ⋈ (ρc2(n2, s, e2)(College))
Relational Algebra - Suan Lee 91
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Stanford Berkeley
Rename operator
For disambiguation in “self-joins”
Pairs of colleges in same state
σn1≠n2(ρc1(n1, s, e1)(College)) ⋈ (ρc2(n2, s, e2)(College))
Relational Algebra - Suan Lee 92
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Stanford BerkeleyBerkeley Stanford
Rename operator
For disambiguation in “self-joins”
Pairs of colleges in same state
σn1<n2(ρc1(n1, s, e1)(College)) ⋈ (ρc2(n2, s, e2)(College))
Relational Algebra - Suan Lee 93
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Berkeley Stanford
Alternate notation (1)
Assignment statements – Pairs of colleges in same state
Relational Algebra - Suan Lee 94
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Alternate notation (1)
Assignment statements – Pairs of colleges in same state
C1 := ρc1, s, e1College
C2 := ρc2, s, e2College
Cp := C1 ⋈ C2
Ans := σn1<n2CP
Relational Algebra - Suan Lee 95
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Alternate notation (2)
Expression tree – GPAs of students applying to CS in CA
Relational Algebra - Suan Lee 96
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
Alternate notation (2)
Expression tree – GPAs of students applying to CS in CA
Relational Algebra - Suan Lee 97
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
⋈
Alternate notation (2)
Expression tree – GPAs of students applying to CS in CA
Relational Algebra - Suan Lee 98
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
⋈
σstate=‘CA’∩ major=‘cs’
Alternate notation (2)
Expression tree – GPAs of students applying to CS in CA
Relational Algebra - Suan Lee 99
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
⋈
σstate=‘CA’∩ major=‘cs’
ΠGPA
Alternate notation (2)
Expression tree – GPAs of students applying to CS in CA
Relational Algebra - Suan Lee 100
sID sName GPA HScName state enr
StudentCollege
sID cName major dec
Apply
⋈
σstate=‘CA’∩ major=‘cs’
ΠGPA
ΠGPA (σ…(C⋈S⋈A))
Relational Algebra summary
Relational Algebra - Suan Lee 101
Relational Algebra summary
CoreR
Relational Algebra - Suan Lee 102
Relational Algebra summary
CoreR
σc(E)
Relational Algebra - Suan Lee 103
Relational Algebra summary
CoreR
σc(E)
ΠA1, …, An(E)
Relational Algebra - Suan Lee 104
Relational Algebra summary
CoreR
σc(E)
ΠA1, …, An(E)
E1×E2
Relational Algebra - Suan Lee 105
Relational Algebra summary
CoreR
σc(E)
ΠA1, …, An(E)
E1×E2
E1∪E2
Relational Algebra - Suan Lee 106
Relational Algebra summary
CoreR
σc(E)
ΠA1, …, An(E)
E1×E2
E1∪E2
E1-E2
Relational Algebra - Suan Lee 107
Relational Algebra summary
CoreR
σc(E)
ΠA1, …, An(E)
E1×E2
E1∪E2
E1-E2
ρR(A1, …, An)(E)
Relational Algebra - Suan Lee 108
Relational Algebra summary
CoreR
σc(E)
ΠA1, …, An(E)
E1×E2
E1∪E2
E1-E2
ρR(A1, …, An)(E)
Abbreviations
Relational Algebra - Suan Lee 109
Relational Algebra summary
CoreR
σc(E)
ΠA1, …, An(E)
E1×E2
E1∪E2
E1-E2
ρR(A1, …, An)(E)
Abbreviations
E1⋈E2
Relational Algebra - Suan Lee 110
Relational Algebra summary
CoreR
σc(E)
ΠA1, …, An(E)
E1×E2
E1∪E2
E1-E2
ρR(A1, …, An)(E)
Abbreviations
E1⋈E2
E1⋈ΘE2
Relational Algebra - Suan Lee 111
Relational Algebra summary
CoreR
σc(E)
ΠA1, …, An(E)
E1×E2
E1∪E2
E1-E2
ρR(A1, …, An)(E)
Abbreviations
E1⋈E2
E1⋈ΘE2
E1 ∩ E2
Relational Algebra - Suan Lee 112
Relational Algebra summary
CoreR
σc(E)
ΠA1, …, An(E)
E1×E2
E1∪E2
E1-E2
ρR(A1, …, An)(E)
Abbreviations
E1⋈E2
E1⋈ΘE2
E1 ∩ E2
Relational Algebra - Suan Lee 113
Relational Algebra summary
CoreR
σc(E)
ΠA1, …, An(E)
(E1)×(E2)
E1∪E2
E1-E2
ρR(A1, …, An)(E)
Abbreviations
E1⋈E2
E1⋈ΘE2
E1 ∩ E2
Relational Algebra - Suan Lee 114
Relational Algebra summary
CoreR
σc(E)
ΠA1, …, An(E)
(E1)×(E2)
E1∪E2
E1-E2
ρR(A1, …, An)(E)
Abbreviations
E1⋈E2
E1⋈ΘE2
E1 ∩ E2
Relational Algebra - Suan Lee 115