In this post we will learn how to add multiple rows to a table with one query.
Example 1:
Add the authors table the authors whose names are Arthur Machen and Jack London in one query.
1 2 |
Insert into authors (name,surname) values ('Arthur','Machen'), ('Jack','London') |
Or
1 2 |
Insert into authors values ('Arthur','Machen'),('Jack','London') |
Example 2:
Add the students table three students whose names and classes only known.
1 2 3 4 |
Insert into students(name,class) values ('Jane','11A'), ('Gray','11B'), ('Mary','11C') |