Skip to content
/Chapter 8 · DML: Measure Twice, Cut Once
Lesson 8.2·garden_shop
Lesson 8.2

Adding Rows with SQL INSERT

INSERT adds new rows. Name the columns, supply matching values, then SELECT to confirm.

INSERT adds new rows. List the columns you're filling, then provide a value for each in the same order. Naming the columns explicitly instead of relying on table order keeps the statement readable and resilient.

Then do what every careful person does after a change: SELECT the row back to confirm it's really there. This exercise runs against a fresh copy each time you click Run, so you can insert as many times as you like.

Pattern
insert into customers (customer_id, first_name, last_name)
values (21, 'Robin', 'Vale');

select * from customers where customer_id = 21;
Schema · Garden ShopTable · products9 columns · 24 rows
Table · products

One row per product, with price, cost, and inventory levels.

9 columns · 24 rows
product_id intproduct_name textcategory_id intsupplier_id intprice decimalcost decimalquantity_on_hand intreorder_level intdiscontinued bool
Your task

Add a new product, then confirm it. Insert a row intoproducts with product_id 25, name'Window Herb Kit', category 2, supplier 6, price 24.00, cost 11.00, 30 on hand, reorder level 10, and not discontinued. ThenSELECTproduct_id, product_name, and price for product 25.

SQL Workbench
query.sqlgarden_shop · SQL engine loading
⌘↵ to run
·
Expected answer
  • Columns: product_id, product_name, price.
  • Rows: 1, the product you just inserted.
  • product_id 25 is 'Window Herb Kit' at price 24.