title: Return all the distinct values of column B in one row for each distinct value in column A
body: <p>Take the following table:</p>
  
  <pre><code>CREATE TABLE boxes (
      box integer,
      color character varying,
      size integer,
      ...
  );
  </code></pre>
  
  <p>where both <code>box</code> and <code>color</code> can assume not unique values out of a small 
  set.</p>
  
  <p>Querying this table with:</p>
  
  <pre><code>SELECT color, box FROM boxes;
  </code></pre>
  
  <p>the result will be something like:</p>
  
  <pre><code>+-------+-----+
  | color | box |
  +-------+-----+
  | blue  |   2 |
  | blue  |   3 |
  | blue  |   4 |
  | green |   1 |
  | green |   3 |
  | red   |   1 |
  | red   |   2 |
  | red   |   2 |
  +-------+-----+
  </code></pre>
  
  <p>Is it possible to query this table in a manner such that the result has two columns, one with an array (or string, or list) with all the different <code>box</code> values for each distinct <code>color</code>?</p>
  
  <p>The result should be something like this:</p>
  
  <pre><code>+-------+-----------+
  | color | box_types |
  +-------+-----------+
  | blue  | {2,3,4}   |
  | green | {1,3}     |
  | red   | {1,2}     |
  +-------+-----------+
  </code></pre>
  
  <p>where the <code>color</code> column must contain unique values, and each row must contain only distinct <code>box</code> numbers in the aggregate column.</p>
  
  <p>Given the non-agnostic character of this question, I would like to collect all the best solutions for the major DBMS. When answering, please specify for which DBMS each query works.</p>