MySQL - WHERE item IN commaSeperatedColumn

MySQL - WHERE item IN commaSeperatedColumn

如何查询逗号分隔值?在 table 中,我有一个名为 colors 的列,它包含这样的颜色代码 1,5,8.

我如何检查值 5 是否在逗号分隔的列 colors 内?

这甚至可以用 MySQL 做吗?

ps: it is possible that there is a single value within the column 'colors'

您可以使用 find_in_set('5', colors)

但是将值存储为 csv 不是好的做法。