Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Inserting data
6. Insert multiple rows
Modifying data
Deleting data
CRUD

Instruction

Magnificent! Now, if you need to fill up your database quickly, you may be wondering how to add a lot of data without much effort. Of course, you could write an INSERT INTO statement for each separate row, but there is also a quicker way. Have a look:

INSERT INTO User (Id, Name)
VALUES
  (6, N'Chris'),
  (7, N'Barbara');

That's right, after the closing parenthesis with the values, you can put a comma and continue adding more rows in the same way. This allows you to add multiple values quickly.

Exercise

Lots of Czech tourists are now coming to the restaurant, and they would like to try some of their national dishes. Let's give them:

  • A main course named Gulas s knedlikem (Id 11, Price 29).
  • A dessert named Vosi Hnizda (Id 12, Price 14).

Stuck? Here's a hint!

Type:

INSERT INTO Dish
VALUES
  (11, N'main course', N'Gulas s knedlikem', 29),
  (12, N'dessert', N'Vosi Hnizda', 14);