Summer Deals - 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, 'Chris'),
  (7, '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, 'main course', 'Gulas s knedlikem', 29),
  (12, 'dessert', 'Vosi Hnizda', 14);