Step 1: Identify the Two Tables Needed. (Each Join Operation Involves Two Tables.)

Step 1: Identify the Two Tables Needed. (Each Join Operation Involves Two Tables.)

<p> Join Operation</p><p>Step 1: Identify the two tables needed. (Each Join operation involves two tables.) </p><p>Exercise 1: If the information you need to answer a query is in four tables, how many join operations will you have to do to get the information you need? Answer: ______</p><p>Step 2: Cartesian Product Operation (X)</p><p>Example: Cartesian Product of EMPLOYEE table and DEPARTMENT Table The resulting number of attributes: # attributes in EMPLOYEE + # attributes in DEPT The answer is ______. The resulting number of tuples: # tuples in EMPLOYEE X # tuples in DEPT The answer is ______.</p><p>EMPLOYEE Lname SSN ... Superssn DNO Smith 123456789 ... 333445555 5 Wong 333445555 ... 888665555 5 English 453453453 ... 333445555 5 Narayan 666884444 ... 333445555 5 Borg 888665555 ... 1 Wallace 987654321 ... 888665555 4 Jabbar 987987987 ... 987654321 4 Zelaya 999887777 ... 987654321 4 DEPT Dname Dnumb MgrSSN MgrStartDate Headquaters 1 er 888665555 19-Jun-71 Administration 4 987654321 01-Jan-85 Research 5 333445555 22-May-78</p><p>CARTESIAN PRODUCT of EMPLOYEE and DEPT Lname SSN ... Superssn DNO Dname Dn MgrSSN MgrStartDate Smith 123456789 ... 333445555 5 Headquaters 1um 888665555 19-Jun-71 Wong 333445555 ... 888665555 5 Headquaters 1 888665555 19-Jun-71 English 453453453 ... 333445555 5 Headquaters 1 888665555 19-Jun-71 Narayan 666884444 ... 333445555 5 Headquaters 1 888665555 19-Jun-71 Borg 888665555 ... 1 Headquaters 1 888665555 19-Jun-71 Wallace 987654321 ... 888665555 4 Headquaters 1 888665555 19-Jun-71 Jabbar 987987987 ... 987654321 4 Headquaters 1 888665555 19-Jun-71 Zelaya 999887777 ... 987654321 4 Headquaters 1 888665555 19-Jun-71 Smith 123456789 ... 333445555 5 Administration 4 987654321 01-Jan-85 Wong 333445555 ... 888665555 5 Administration 4 987654321 01-Jan-85 English 453453453 ... 333445555 5 Administration 4 987654321 01-Jan-85 Narayan 666884444 ... 333445555 5 Administration 4 987654321 01-Jan-85 Borg 888665555 ... 1 Administration 4 987654321 01-Jan-85 Wallace 987654321 ... 888665555 4 Administration 4 987654321 01-Jan-85 Jabbar 987987987 ... 987654321 4 Administration 4 987654321 01-Jan-85 Zelaya 999887777 ... 987654321 4 Administration 4 987654321 01-Jan-85 Smith 123456789 ... 333445555 5 Research 5 333445555 22-May-78 Wong 333445555 ... 888665555 5 Research 5 333445555 22-May-78 English 453453453 ... 333445555 5 Research 5 333445555 22-May-78 Narayan 666884444 ... 333445555 5 Research 5 333445555 22-May-78 Borg 888665555 ... 1 Research 5 333445555 22-May-78 Wallace 987654321 ... 888665555 4 Research 5 333445555 22-May-78 Jabbar 987987987 ... 987654321 4 Research 5 333445555 22-May-78 Zelaya 999887777 ... 987654321 4 Research 5 333445555 22-May-78 Step 3: Specify a JOIN Condition (e.g., selection criteria with comparison of values of attributes between two tables) according to your query.</p><p>Exercise 2: If the query is to find the last names of employees who work for “Research” Department, the join condition is ______.</p><p>Exercise 3: If the query is to find the first name of all the department managers, the join condition is ______.</p><p>Step 4: Join Results: Based on the selection, keep only the tuples that meet the join condition, throw away all other tuples.</p><p>Join attributes must have the same domain Comparison operator can be : =, <, >, etc. (Theta Join)</p><p>If only equality comparison is involved (the most common comparisons in queries): Equijoin: Keep both of the two join attributes in the result Natural Join: Keep only the first of the two join attribute in the result (e.g., getting rid of the second join attributes).</p><p>Exercise 4: What will be the join result for finding the last names of employees who work for “Research” Department?</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    2 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us