l********r 发帖数: 140 | 1 MySQL
For example, I want to create a table like:
FamilyID, Member_Names
10, [Tom, Bob, Kitty]
where Member_Names is of type Array (or list).
Instead, I have to do it like this:
FamilyID, Name
10, Tom
10, Bob
10, Kitty
And when query, aggregate the column Name to a array (list), like "select
Name from my_table where FamilyID = 10", then use the ResultSet to re-create
them into Array (I am using Java).
Am I right?
Thanks a lot. | I******e 发帖数: 101 | 2 Yes, that is the typical normalization work of the database. | a*******s 发帖数: 324 | 3 select familyID, concat_ws(',', Member_Names) from my_table where FamilyID =
10 group by familyID;
【在 l********r 的大作中提到】 : MySQL : For example, I want to create a table like: : FamilyID, Member_Names : 10, [Tom, Bob, Kitty] : where Member_Names is of type Array (or list). : Instead, I have to do it like this: : FamilyID, Name : 10, Tom : 10, Bob : 10, Kitty
|
|