0
有两个表格,第一个表格为country_sports
,列为country_id
,country_name
,sports_id
和date
。第二个是sports
与列sports_id
,sports_name
,sports_date
。如何做插入语句在列中输入多个ID? SQL语句
当我在网络应用中发布表格并给出sports_name
并选择运动列表时,我想创建一个插入语句,选择sports_name
并获取运动ID的列表并将其放入第一个表'country_sports ”。
这里,sports_id
应该有多个ID。
例如,
insert into country_sports (country_id, country_name, sports_id, date)
values ('', '', '', curdate());
例如,数据结构应该是
('1', 'germany', '1, 2, 3, 4', 12-02-2017);
我认为你必须在你的例子准备4个独立的刀片。你没有指定哪个数据库。 – etsa
@etsa,它是MYSQL数据库。 –
你描述一个多对多的关系,这将意味着你将不得不增加已fk_country_sports_id和fk_sports_id第3表,表中有没有展现国家运动和体育 –