Relational Algebra,

advertisement
Reserves
sid
22
58
bid
101
103
Sailors
day
10/10/96
11/12/96
sid
22
31
58
sname
dustin
lubber
rusty
Basic operations:
Selection ( σ ) gives a subset of rows.
Projection ( π ) Deletes unwanted cols.
Cross-product (  ) combine two relations.
Set-difference ( — ) Tuples in reln. 1,
but not in reln. 2.
Union (  ) Tuples in reln. 1 and in reln. 2.
Boats
rating
7
8
10
age
45.0
55.5
35.0
bid
101
102
103
104
bname
Interlake
Interlake
Clipper
Marine
color
Blue
Red
Green
Red
Additional operations:
Intersection () – Tuples in both relns.
Join (
) – like  but only keep tuples
where common fields equal
Division ( / ) – tuples from reln 1 with
matches in reln 2
Renaming ( ρ) – Rename columns
Find names of sailors who’ve reserved boat #103
Find names of sailors who’ve reserved a red boat
Find sailors who’ve reserved a red or a green boat
Find sailors who’ve reserved a red and a green boat
Find the names of sailors who’ve reserved all boats
Download