Sql 在一对多关系中插入命令

Sql 在一对多关系中插入命令,sql,sql-insert,Sql,Sql Insert,根据链接中的解决方案,用户能否同时插入3个问题及其答案?如何插入?插入将占用多行。比如说 -- Person 10 answered survey 5. -- Question 1 they picked Offered Answer 3 -- Question 2 they picked Offered Answer 6 -- Question 3 they picked Offered Answer 7 insert into answer (SurveyID, QuestionID, Of


根据链接中的解决方案,用户能否同时插入3个问题及其答案?如何插入?

插入将占用多行。比如说

-- Person 10 answered survey 5.
-- Question 1 they picked Offered Answer 3
-- Question 2 they picked Offered Answer 6
-- Question 3 they picked Offered Answer 7
insert into answer (SurveyID, QuestionID, OfferedAnswerID, PersonID)
  values (5, 1, 3, 10), (5, 2, 6, 10), (5, 3, 7, 10);

insert
将占用多行。比如说

-- Person 10 answered survey 5.
-- Question 1 they picked Offered Answer 3
-- Question 2 they picked Offered Answer 6
-- Question 3 they picked Offered Answer 7
insert into answer (SurveyID, QuestionID, OfferedAnswerID, PersonID)
  values (5, 1, 3, 10), (5, 2, 6, 10), (5, 3, 7, 10);

用你正在使用的数据库标记你的问题。用你正在使用的数据库标记你的问题。