1 / 5

Exercises

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,

janae
Download Presentation

Exercises

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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

  2. 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

  3. 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

  4. 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

  5. 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

More Related