title: PostgreSQL Calculated Column with values of another table referenced by foreign key
body: <p>I'm currently working on a simple dummy project to refresh my knowledge on SQL and to learn a few new things  :)  </p>
  
  <p>I have a table <code>Article</code> with the columns:</p>
  
  <pre><code>aID, price 
  </code></pre>
  
  <p>I have another table <code>Storage</code>:</p>
  
  <pre><code>sID, aID, count  
  </code></pre>
  
  <p>The <code>Storage</code> table references the <code>aID</code> as a foreign key and the count column say how much of an article is stored.  </p>
  
  <p>Now I want to add a column <code>value</code> to my <code>Storage</code> table. This column should be calculated by <code>Article.price * Storage.count</code>.</p>
  
  <p>I found after searching the web that you can have calculated columns like this  </p>
  
  <pre><code>CREATE TABLE tbl 
  (
       int1 INT,
       int2 INT,
       product BIGINT GENERATED ALWAYS AS (int1 * int2) STORED
  );
  </code></pre>
  
  <p>But I haven't found an example how to this with columns from another table.  </p>
  
  <p>What do I have to do in order to use the price from the referenced aID in the calculation?</p>