Sqlite query fields are encapsulated into arrays, how to implement sql

there are two tables:
1, user table (id,name,age),
2, profile picture table (id,user_id,image).
purpose: A user can save multiple avatars .
query everyone, and each user record contains all his pictures (if any). The desired query result is: [(name,age, [image,image,image ])]
ask for advice

May.15,2022

use the group_concat function separated by commas. Split
in the business code to see which is faster and which is faster

.
select
    a.name,
    a.age,
    b.image
from  as a
left join (select user_id, group_concat(image) as image from  group by user_id) as b
on a.id=b.user_id


select
    a.name,
    a.age
    group_concat(b.image) as image
from  as a,  as b
where a.id=b.user_id
group by a.name, a.age

1, first define an empty array user_info= []
2, and add the contents of the first table user_id,name,age to the array first. You will get [(userid1,name1,age1, []), (userid2,name2,age2, []).], with the empty array behind it to store the image data later.
3, add one match at a time

-sharp 
for i in tb_er:
    -sharp user_infouserid
    for j in user_info:
        if i[1] == j[0]: 
            j[0] = j[3].append(i[2])

is a stupid method, but it can be realized.

Menu