title: Display table where foreign keys are values from second column of referenced tables
body: <p>Is it possible to write such a universal query? By universal I mean that I won't need to type column names that are foreigns keys, so that I can use this query for other tables. Simple example:</p>
  
  <pre><code>[table workers]
  ID [PK] | worker | department [FK]
  --------+--------+-----------
  1       | Smith  | 2
  
  [table departments]
  ID [PK] | department
  --------+------------+
  1       | Paris      |
  2       | Oslo       |
  </code></pre>
  
  <p>After <code>SELECT/JOIN</code> query it would be displayed as:</p>
  
  <pre><code>ID [PK] | worker | department [FK]
  --------+--------+-----------
  1       | Smith  | Oslo
  </code></pre>
  
  <p>But instead of writing:</p>
  
  <pre><code>SELECT workers.ID, workers.worker, departments.department
  FROM workers JOIN departments ON workers.department = departments.ID;
  </code></pre>
  
  <p>which would work only for <code>workers</code> and <code>departments</code> I'd prefer something more universal like:</p>
  
  <pre><code>SELECT * FROM [tableName] JOIN [referenced table#1], 
  [referenced table#2]...[#n] 
  ON [tableName].FK#1 = [referenced table#1].[2nd column], 
  [tableName].FK#2 = [referenced table#2].[2nd column]...#n
  </code></pre>
  
  <p>where <code>#n</code> - number of foreign keys and their referenced tables which varies for every table.</p>