Is it possible to format SQL on output into associative array? We have a table.

customer         
+----+------+------+-------+
| id | type | name | group |
+----+------+------+-------+
| 1  | boy  | dave | adult |
| 2  | girl | lisa | child |
| 3  | girl | amy  | adult |
| 4  | boy  | ivan | child |
+------------------+-------+


If we query this table with

SELECT * FROM `customer` WHERE type = 'girl'


Result output

Array
(
    [0] =&gt; Array
        (
            [id] =&gt; 2
            [type] =&gt; girl
            [name] =&gt; lisa
            [group] =&gt; child
        )
    [1] =&gt; Array
        (
            [id] =&gt; 3
            [type] =&gt; girl
            [name] =&gt; amy
            [group] =&gt; adult
        )
)


I would like to receive the output like the following.

Array
(
    [girl] =&gt; Array
        (
        [child] =&gt; Array
            (
                [id] =&gt; 2
                [name] =&gt; lisa
            )
        [adult] =&gt; Array
            (
                [id] =&gt; 3
                [name] =&gt; amy
            )
        )
)


I could manipulate the result with another programming language, but wondered if this is possible with pure SQL?

Thanks in advance.
As far as I know, no SQL has yet been designed to return associative arrays, but I could be wrong!