50 likes | 161 Views
Solution 2:. Exercises. Reserves. Sailors. Boats. Solution 1: . Basic operations: Selection ( σ ) gives a subset of rows. Projection ( π ) Deletes unwanted cols. Cross-product ( ) combine two relations. Set-difference ( — ) Tuples in reln. 1,
E N D
Solution 2: Exercises Reserves Sailors Boats • Solution 1: 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. 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
A more efficient solution: Exercises Reserves Sailors Boats 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. 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 a red boat
Exercises Reserves Sailors Boats 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. 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 sailors who’ve reserved a red or a green boat
Exercises Reserves Sailors Boats 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. 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 sailors who’ve reserved a red and a green boat
Exercises Reserves Sailors Boats 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. 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 the names of sailors who’ve reserved all boats