开发者

Are there StringCollections in MySQL?

开发者 https://www.devze.com 2023-03-31 13:14 出处:网络
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

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

精彩评论

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