title: Java - Merge data from 2 tables in different data source
body: <p>I have a use case, where I have to merge data from 2 Tables (which are in different data sources).
  Consider that each table has employee data (First name, last name, phoneNumber). For each employee, I will have to merge the phoneNumber data from both the Tables and other data will remain the same as in Table 1</p>
  <ol>
  <li>If employee data is present in both Table 1 and Table 2, phoneNumber data will be merged as a comma separated values and other data will be sourced from Table 1</li>
  <li>If employee is present only in Table 1, then entire data will be sourced from Table 1</li>
  <li>If employee is present only in Table 2, then entire data will be sourced from Table 2</li>
  </ol>
  <p>These Tables has about 40 lack rows of data each. Close to 5GB.
  What is the best approach to do this in Java? My concern is if I pull the data from these 2 tables into Java cache, i will still have to loop thought the entire table 2 to see if an employee is present there as well.
  Or will a python script be better?</p>
  <p>Table 1</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>EmployeeID</th>
  <th>FirstName</th>
  <th>LastName</th>
  <th>PhoneNumber</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>EM01</td>
  <td>Jhon</td>
  <td>Doe</td>
  <td><strong>12345</strong></td>
  </tr>
  <tr>
  <td>EM02</td>
  <td>Dave</td>
  <td>Joe</td>
  <td>34567</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Table 2:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>EmployeeID</th>
  <th>FirstName</th>
  <th>LastName</th>
  <th>PhoneNumber</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>EM01</td>
  <td>Jhon</td>
  <td>Doe</td>
  <td><strong>89000</strong></td>
  </tr>
  <tr>
  <td>EM03</td>
  <td>Gabe</td>
  <td>Mai</td>
  <td>45678</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Table 3 (After merging the phone numbers):</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>EmployeeID</th>
  <th>FirstName</th>
  <th>LastName</th>
  <th>PhoneNumber</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>EM01</td>
  <td>Jhon</td>
  <td>Doe</td>
  <td><strong>12345,89000</strong></td>
  </tr>
  <tr>
  <td>EM02</td>
  <td>Dave</td>
  <td>Joe</td>
  <td>34567</td>
  </tr>
  <tr>
  <td>EM03</td>
  <td>Gabe</td>
  <td>Mai</td>
  <td>45678</td>
  </tr>
  </tbody>
  </table>
  </div>