title: Does SQL have a way to group rows without squashing the group into a single row?
body: <p>I want to do a single query that outputs an array of arrays of table rows. Think along the lines of <code>&lt;table&gt;&lt;rowgroup&gt;&lt;tr&gt;&lt;tr&gt;&lt;tr&gt;&lt;rowgroup&gt;&lt;tr&gt;&lt;tr&gt;</code>. Is SQL capable of this? (specifically, as implemented in MariaDB, though migration to AWS RDS might occur one day)<br>
  The <code>GROUP BY</code> statement alone does not do this, it creates one row per group.</p>
  
  <p>Here's an example of what I'm thinking of…</p>
  
  <pre><code>SELECT * FROM memes;
  
  +------------+----------+
  | file_name  | file_ext |
  +------------+----------+
  | kittens    | jpeg     |
  | puppies    | gif      |
  | cats       | jpeg     |
  | doggos     | mp4      |
  | horses     | gif      |
  | chickens   | gif      |
  | ducks      | jpeg     |
  +------------+----------+
  
  SELECT * FROM memes GROUP BY file_ext WITHOUT COLLAPSING GROUPS;
  
  +------------+----------+
  | file_name  | file_ext |
  +------------+----------+
  | kittens    | jpeg     |
  | cats       | jpeg     |
  | ducks      | jpeg     |
  +------------+----------+
  | puppies    | gif      |
  | horses     | gif      |
  | chickens   | gif      |
  +------------+----------+
  | doggos     | mp4      |
  +------------+----------+
  </code></pre>
  
  <p>I've been using MySQL for ~20 years and have not come across this functionality before but maybe I've just been looking in the wrong place <code>¯\_(ツ)_/¯</code></p>