Example: Grouping/Aggregation R= A B C 2 Then,average Cwithin 4 5 6 groups: 1 2 5 A B AVG(C) (R)=? 1 2 4 First,group R: 5 6 A B C 1 2 3 1 5 25 6
Example: Grouping/Aggregation R = A B C 123 456 125 γ A,B,AVG(C) (R) = ?? First, group R : A B C 123 125 456 Then, average C within groups: A B AVG(C) 1 2 4 4 5 6
Outjoin The normal join can "lose"information, because a tuple that doesn't join with any from the other relation(dangles)has no vestige in the join result. The null value can be used to "pad"dangling tuples so they appear in the join. Gives us the outerjoin operator 0凶 Variations:theta-outjoin,left-and right- outjoin (pad only dangling tuples from the left (resp.,right)
Outjoin The normal join can “lose”information, because a tuple that doesn’t join with any from the other relation(dangles) has no vestige in the join result. The null value can be used to “pad”dangling tuples so they appear in the join. Gives us the outerjoin operator ° Variations: theta-outjoin, left- and rightoutjoin (pad only dangling tuples from the left (resp., right)
Example:Outerjoin R= A B s = B C 1 2 2 3 4 5 6 (1,2)joins with(2,3),but the other two tuples are dangling. R OUTERJOIN S A B C 1 2 3 4 5 NULL NULL 6 7
Example: Outerjoin R = A B S = B C 1 2 2 3 4 5 6 7 (1,2) joins with (2,3), but the other two tuples are dangling. R OUTERJOIN S = A B C 123 45N U L L NULL 6 7