Order report
- SQL course
- Beginner
- Lesson 113/115
- 6 min
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
-- insert two rows
INSERT INTO products
VALUESSample solution
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.