relational algebra2
TRANSCRIPT
![Page 1: Relational algebra2](https://reader030.vdocuments.net/reader030/viewer/2022021506/58aaddb71a28ab27178b5b49/html5/thumbnails/1.jpg)
Jennifer Widom
Relational Databases
Relational Algebra (2) Set operators, renaming, notation
![Page 2: Relational algebra2](https://reader030.vdocuments.net/reader030/viewer/2022021506/58aaddb71a28ab27178b5b49/html5/thumbnails/2.jpg)
Jennifer Widom
Relational Algebra (2)
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)
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
![Page 3: Relational algebra2](https://reader030.vdocuments.net/reader030/viewer/2022021506/58aaddb71a28ab27178b5b49/html5/thumbnails/3.jpg)
Jennifer Widom
Union operator
List of college and student names
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (2)
![Page 4: Relational algebra2](https://reader030.vdocuments.net/reader030/viewer/2022021506/58aaddb71a28ab27178b5b49/html5/thumbnails/4.jpg)
Jennifer Widom
Difference operator
IDs of students who didn’t apply anywhere
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (2)
IDs and names of students who didn’t apply anywhere
![Page 5: Relational algebra2](https://reader030.vdocuments.net/reader030/viewer/2022021506/58aaddb71a28ab27178b5b49/html5/thumbnails/5.jpg)
Jennifer Widom
Intersection operator
Names that are both a college name and a student name
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (2)
![Page 6: Relational algebra2](https://reader030.vdocuments.net/reader030/viewer/2022021506/58aaddb71a28ab27178b5b49/html5/thumbnails/6.jpg)
Jennifer Widom
Intersection doesn’t add expressive power (1)
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (2)
![Page 7: Relational algebra2](https://reader030.vdocuments.net/reader030/viewer/2022021506/58aaddb71a28ab27178b5b49/html5/thumbnails/7.jpg)
Jennifer Widom
Intersection doesn’t add expressive power (2)
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (2)
![Page 8: Relational algebra2](https://reader030.vdocuments.net/reader030/viewer/2022021506/58aaddb71a28ab27178b5b49/html5/thumbnails/8.jpg)
Jennifer Widom
Rename operator
1.
2.
3.
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (2)
![Page 9: Relational algebra2](https://reader030.vdocuments.net/reader030/viewer/2022021506/58aaddb71a28ab27178b5b49/html5/thumbnails/9.jpg)
Jennifer Widom
Rename operator To unify schemas for set operators
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (2)
List of college and student names
![Page 10: Relational algebra2](https://reader030.vdocuments.net/reader030/viewer/2022021506/58aaddb71a28ab27178b5b49/html5/thumbnails/10.jpg)
Jennifer Widom
Rename operator For disambiguation in “self-joins”
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (2)
Pairs of colleges in same state
![Page 11: Relational algebra2](https://reader030.vdocuments.net/reader030/viewer/2022021506/58aaddb71a28ab27178b5b49/html5/thumbnails/11.jpg)
Jennifer Widom
Alternate notation (1) Assignment statements – Pairs of colleges in same state
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (2)
![Page 12: Relational algebra2](https://reader030.vdocuments.net/reader030/viewer/2022021506/58aaddb71a28ab27178b5b49/html5/thumbnails/12.jpg)
Jennifer Widom
Alternate notation (2) Expression tree – GPAs of students applying to CS in CA
cName state enr sID sName GPA HS sID cName major dec
College Student Apply
Relational Algebra (2)
![Page 13: Relational algebra2](https://reader030.vdocuments.net/reader030/viewer/2022021506/58aaddb71a28ab27178b5b49/html5/thumbnails/13.jpg)
Jennifer Widom
Relational Algebra summary
Relational Algebra (2)
Webcam Video (delete this
in final version!)