如何使用jdbc将数据插入到具有mysql数据库的SET列中?

时间:2022-09-25 19:19:21

I have a problem.
I have a database with table accommodation in it.

我有个问题。我有一个包含表格的数据库。

It has a column attributes with a datatype called SET datatype(mysql).

它有一个列属性,其数据类型名为SET datatype(mysql)。

I want to set data with jdbc into this attributes column.

我想用jdbc将数据设置到此属性列中。

Can you please help how to do it.

你能帮忙怎么做。

1 个解决方案

#1


0  

Try using a query with the FIND_IN_SET keyword.

尝试使用FIND_IN_SET关键字的查询。

EDIT: sorry, you are trying to insert. Example from here:

编辑:抱歉,您正在尝试插入。这里的例子:

INSERT INTO myset (col) VALUES ('a,d'), ('d,a'), ('a,d,a'), ('a,d,d'), ('d,a,d');

EDIT: removed dead link to http://www.vbmysql.com/articles/mysql/the-mysql-set-datatype

编辑:删除死链接到http://www.vbmysql.com/articles/mysql/the-mysql-set-datatype

#1


0  

Try using a query with the FIND_IN_SET keyword.

尝试使用FIND_IN_SET关键字的查询。

EDIT: sorry, you are trying to insert. Example from here:

编辑:抱歉,您正在尝试插入。这里的例子:

INSERT INTO myset (col) VALUES ('a,d'), ('d,a'), ('a,d,a'), ('a,d,d'), ('d,a,d');

EDIT: removed dead link to http://www.vbmysql.com/articles/mysql/the-mysql-set-datatype

编辑:删除死链接到http://www.vbmysql.com/articles/mysql/the-mysql-set-datatype