CodeBlanks Logo Icon CodeBlanks

Order report

Insert, update and delete rows on the order table.

Challenge 2: Insert data

In this challenge you will write an INSERT that adds two rows to a table. Use multi-row insert.

INSERT INTO products (id, name, price) VALUES (1, 'A', 5), (2, 'B', 10);

This query adds two rows in one query.

The values given with VALUES are inserted into products as new rows.

Practice Challenge 2: Insert data

Insert id=1 name='Pen' price=5 and id=2 name='Book' price=12 into products in one query.

Starter code

query.sql
-- insert two rows
INSERT INTO products
VALUES

Sample solution

query.sql
INSERT INTO products (id, name, price)
VALUES (1, 'Kalem', 5), (2, 'Defter', 12)

Expected output

2 satır eklendi

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Order report: match the terms

Term Meaning
INSERT insert
VALUES values
comma separate sets
INTO into

2 What separates value sets in multi-row?

  • A colon
  • A semicolon
  • A space
  • A comma Correct answer

Explanation: Value sets are separated by commas.

All lessons in Beginner