Presentation is loading. Please wait.

Presentation is loading. Please wait.

Relational Databases Relational Algebra (2)

Similar presentations


Presentation on theme: "Relational Databases Relational Algebra (2)"— Presentation transcript:

1 Relational Databases Relational Algebra (2)
Set operators, renaming, notation

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) College Student Apply cName state enr sID sName GPA HS sID cName major dec

3 Relational Algebra (2) Union operator
List of college and student names College Student Apply cName state enr sID sName GPA HS sID cName major dec

4 Relational Algebra (2) Difference operator
IDs of students who didn’t apply anywhere IDs and names of students who didn’t apply anywhere College Student Apply cName state enr sID sName GPA HS sID cName major dec

5 Intersection operator
Relational Algebra (2) Intersection operator Names that are both a college name and a student name College Student Apply cName state enr sID sName GPA HS sID cName major dec

6 Intersection doesn’t add expressive power (1)
Relational Algebra (2) Intersection doesn’t add expressive power (1) College Student Apply cName state enr sID sName GPA HS sID cName major dec

7 Intersection doesn’t add expressive power (2)
Relational Algebra (2) Intersection doesn’t add expressive power (2) College Student Apply cName state enr sID sName GPA HS sID cName major dec

8 Relational Algebra (2) Rename operator 1. 2. 3. College Student Apply
cName state enr sID sName GPA HS sID cName major dec

9 To unify schemas for set operators
Relational Algebra (2) Rename operator To unify schemas for set operators List of college and student names College Student Apply cName state enr sID sName GPA HS sID cName major dec

10 For disambiguation in “self-joins”
Relational Algebra (2) Rename operator For disambiguation in “self-joins” Pairs of colleges in same state College Student Apply cName state enr sID sName GPA HS sID cName major dec

11 Assignment statements – Pairs of colleges in same state
Relational Algebra (2) Alternate notation (1) Assignment statements – Pairs of colleges in same state College Student Apply cName state enr sID sName GPA HS sID cName major dec

12 Expression tree – GPAs of students applying to CS in CA
Relational Algebra (2) Alternate notation (2) Expression tree – GPAs of students applying to CS in CA College Student Apply cName state enr sID sName GPA HS sID cName major dec

13 Relational Algebra (2) Relational Algebra summary


Download ppt "Relational Databases Relational Algebra (2)"

Similar presentations


Ads by Google