开发者

Are there StringCollections in MySQL?

I was needing a StringCollection field in my database but I don't know if MySQL has a开发者_C百科nything of the sort, does it?


String collections are usually implemented as a 1-to-many relation with a foreign key. For example, to add a string collection for rows in Table1, you'd set up Table2 like:

Table1: id, name, ...
Table2: Table1Id foreign key references Table1(id), strValue, ...

Example values where Table1 contains football teams, with a string collection of players:

Table1: 1, "Manchester United"
        2, "Liverpool"

Table2: 1, "Bobby Charlton"
        1, "Wayne Rooney" 
        2, "Steven Gerrard"
        2, "Michael Owen"


There is the mysql SET type.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜