String Aggregation in sqlite

You're looking for something like the following:

select group_concat(animal) from animals;

This will return something like the following:

dog,cat,rat,mice,mouse

If you don't want to use a comma as the separator, you can add your own separator as a second parameter:

select group_concat(animal, '_') from animals;

which will return:

dog_cat_rat_mice_mouse

I think this will be useful:

group_concat(X)
group_concat(X,Y)

The group_concat() function returns a string which is the concatenation of all non-NULL values of X. If parameter Y is present then it is used as the separator between instances of X. A comma (",") is used as the separator if Y is omitted. The order of the concatenated elements is arbitrary.