title: How can you find relations in tables that don't have constraints for these relations?
body: <p>I have a database with a lot of tables (644) and none of them have "system" relations or constraints, they have relations because the values match each other. When they created the table, they never set the constraints or relation. I cannot even get the ERD model because there's no "system" relation between the tables, only matching values relation. </p>
  
  <p>The problem is that some tables have relation because they have the same value but the names of columns don't have any similar names to understand the relations.</p>
  
  <p>For example there's a column named <code>table1.laborcode</code> and it has relation with <code>table2.personid</code>.</p>
  
  <p>I thought that there might be a SQL query or code that you can execute and find all matching values between all tables. </p>
  
  <p>For example, here I only know that these two tables has the relation with matching values:</p>
  
  <pre><code>table1.laborcode = 123
  table2.personid = 123
  </code></pre>
  
  <p>If you have any questions about this issue: you can ask me and I'll answer it.</p>