Relational Query Languages
- Selection of Attributes
- Projection
- Π A, C (r)
after projection |
- Cartesian Product - Cross product!
relations r and s |
- Cartesian product returns every possible pair in the result.
r ╳ s |
relations r and s |
- r ∩ s =
intersection |
- Natural Join
- Let r and s be relations on schemas R and S respectively. Then, the 'natural join' of relations R and S is a relation on schema R∪ S obtain as follows:
- Consider each pair of tuples tr from r and ts form s.
- If tr and ts have the same value on each of the attributes in R∩ S, add a tuple t to the result, where
- t has the same value as tr on r
- t has the same value as ts on s
relations r and s |
- r ⋈ s
Natural join r and s |
No comments:
Post a Comment