title: sql table with primary key from another table
body: <p>This question are going to probably be very basic but I am new to SQL. I am trying to create a new table based of a previous table that will use the primary key from the orinal table and display the value of that id.</p>
  
  <p>Table_1:</p>
  
  <pre><code>Field   Type            Null   Key       Default       Extra
  -----   ----            ----   ---       -------       -----
  ID      int(11)         NO     PRI                     auto_increment
  fruit   varchar(255)    NO          
  </code></pre>
  
  <p>The results are:</p>
  
  <pre><code>ID  fruit
  --  -----
  1   Apple
  2   Orange
  3   Pear
  4   Grape
  5   BlueBerry
  6   StrwBerry
  7   Kiwi
  </code></pre>
  
  <p>For table two I would like to be able to have a primary_id, table_1_id, table_1_name, color, location.</p>
  
  <p>Something like this:</p>
  
  <pre><code>ID  table_1_id  table_1_fruit_name   color   location
  --  ----------  ------------------   -----   --------
  1   1           Apple                Red     Farm
  2   1           Apple                Green   Store
  3   2           Orange               Orange  Store
  4   4           Grape                Green   Farm
  5   4           Grape                Green   Store
  </code></pre>
  
  <p>I am getting lost on how to create this. I have tried using constraints ( assuming that is what I should use ). </p>