title: Insert multiple rows in one table based on number in another table
body: <p>I am creating a database for the first time using Postgres 9.3 on MacOSX.</p>
  
  <p>Let's say I have table <code>A</code> and <code>B</code>. <code>A</code> starts off as empty and <code>B</code> as filled. I would like the number of entries in column <code>all_names</code> in table <code>B</code> to equal the <code>number</code> for each <code>names</code> in table <code>A</code> like table <code>B</code> below. Thus <code>names</code> should contain each unique entry from <code>all_names</code> and <code>number</code> its count. I am not used to the syntax, yet, so I do not really know how to go about it. The <code>birthday</code> column is redundant.</p>
  
  <p>Table <strong><code>A</code></strong></p>
  
  <pre><code>names | number
  ------+--------
  Carl  | 3
  Bill  | 4
  Jen   | 2
  </code></pre>
  
  <p>Table <strong><code>B</code></strong></p>
  
  <pre><code> all_names | birthday
  -----------+------------
  Carl       | 17/03/1980
  Carl       | 22/08/1994
  Carl       | 04/09/1951
  Bill       | 02/12/2003
  Bill       | 11/03/1975
  Bill       | 04/06/1986
  Bill       | 08/07/2005
  Jen        | 05/03/2009
  Jen        | 01/04/1945
  </code></pre>
  
  <p>Would this be the correct way to go about it?</p>
  
  <pre><code>insert into a (names, number)
  select b.all_names, count(b.all_names)
  from b
  group by b.all_names;
  </code></pre>