"Such things" are in no way stored in this form in the database. Such tables are built using grouping. For example:
select id ,group_CONCAT(id_of_composition) as composition from table group by type;
This is the case if you need to group identifiers. In the case of names, the same function will be used, but the request will be a little more complicated.
More complicated example:
There are tables
composition (составляющие) | id_comp | name | -------------------- |1 | молоко | |2 | мясо | |3 | кофе | |4 | масло | |5 | хлеб | dish (блюда) | id_dish | name | -------------------------------- |1 | кофе с молоком | |2 | бутерброд с мясом | |3 | бутерброд с маслом | entry (вхождения) | id_entry | id_dish | id_comp| -------------------------------- |1 | 1 | 3 | |2 | 1 | 1 | |3 | 2 | 5 | |4 | 2 | 2 | |5 | 3 | 5 | |6 | 3 | 2 |
Request:
Select d.name ,group_CONCAT(c.name) as composition From composition c ,dish d ,entry e Where d.id_comp = e.id_comp and e.id_dish = d.id_dish Group by d.name,
select t1.name, t1.description, group_concat(t2.name) from t1,t2,t3 where t1.id=t2.blud_id and t3.id=t2.prod_id group by t1.name, t1.description
. - Mike