I have searched and read how to insert multiple rows in mySQL without typing insert again. But something is wrong. Can u please help me?
this is my code:
INSERT INTO studentsection (StudentSectionID,SectionID,StudentID)
VALUES ('4','1','13'),('5','2','2'),('6','2','6'),('7','2','10'),('8','2','14'),('9','3','3'),('10','3','7'),('40','3','11'),('11','3','15'),('12','4','4'),('13','4','8'),('14','4','12'),('15','4','16'),('16','5','1'),('17','5','5'),('18','5','9'),('19','5','13'),('20','6','2'),('21','6','6'),('22','6','10'),('23','6','14'),('24','7','3'),('25','7','7'),('26','7','11'),('27','7','15'),('28','8','4'),('29','8','8'),('30','8','12'),('31','8','16'),('32','9','1'),('33','9','5'),('34','9','9'),('35','9','13'),('36','10','2'),('37','10','6'),('38','10','10'),('39','10','14');
this is the error i get:
#1452 - Cannot add or update a child row: a foreign key constraint fails (`university`.`studentsection`, CONSTRAINT `studentsection_ibfk_1` FOREIGN KEY (`StudentID`) REFERENCES `student` (`StudentID`))
Whats wrong with my code?