title: SQL: Compare if a value exist in another table and vice versa
body: <p>I have two tables:</p>
  
  <pre><code>**Table1**
  
  COD_1    DATE
  001      05/10/2020
  002      05/11/2020
  003      05/12/2020
  
  **Table2**
  
  COD_2   Date
  001     12/12/2008 
  002     12/11/2008 
  008     12/09/2008 
  </code></pre>
  
  <p>I would like to compare the COD column of Table1 with the COD column of Table2. Each value of these two columns is never repeated.
  So I would like to create a third table that shows the CODs, two columns named col_Table1 and col_Table2 and their respective dates. Each of these columns (col_Table1 and col_Table2) informing whether the respective COD is in table 1 or table 2, or in both tables.
  The final table should be something like this:</p>
  
  <pre><code>COD_newTable    col_Table1  col_Table2  DATE_table1  DATE_table2
  001              Yes         Yes        05/10/2020   12/12/2008
  002              Yes         Yes        05/11/2020   12/11/2008
  003              Yes         No         05/12/2020
  008              No          Yes                     12/09/2008
  </code></pre>
  
  <p>Can someone help me, please?</p>