Something wrong with Inserting multiple rows in MySQL -


I have searched and read to insert multiple rows without typing without inserting it. But something is wrong Can you please help me?

This is my code:

  Student (student science, student ID, student ID) 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 error I get:

  # 1452 - The child row can not be added or updated: a foreign key constraint fails Student's (Students 'student),' Student student ',' contract 'student class (`student id`) reference' student '(` student id'))  

What's wrong with my code?

In fact you may studentsection with StudentID , Which do not have any other records student table. Insert all the students before executing that code.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -