INSERT rows in SQL
INSERT adds rows; one VALUES list per row.
INSERT INTO products (sku, name, price)
VALUES
('TS-001', 'Keyboard', 89.00),
('TS-002', 'Keycap set', 45.50),
('TS-003', 'Wrist rest', 19.99)
RETURNING id, sku;
How it works
- Naming the columns makes the statement survive a schema change.
- Several tuples in one statement insert in a single pass.
RETURNINGhands back the generated ids.
Keywords and builtins used here
INSERTINTOVALUES
The run, in numbers
- Lines
- 6
- Characters to type
- 161
- Tokens
- 45
- Three-star pace
- 80 tpm
At the three-star pace of 80 tokens a minute, this run takes about 34 seconds.
Step 4 of 8 in Tables & rows, step 17 of 23 in Language basics.