开发者

Using the `set` datatype in MySQL

I just came across a requirement of labeling a user as 1 of 3 different rol开发者_运维知识库es. Normally I have used an id, but the roles don't really relate to each other at all.

I had a look at the set datatype, and I added the 3 different options.

  • Will the database internally just store the index of the set, e.g. if the set is set('a', 'b', 'c') and I choose a, will it store a or the index 0?

  • I haven't seen this datatype used before when looking at other people's databases. Is it bad practice? Is using an id (perhaps role_id which maps to a table roles) a better idea?

Thanks


They're roles - that's how they relate to one another.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜