1. Adding a row with INSERT
So far we only read data. INSERT adds a new row:
INSERT INTO products (id, name, category, price) VALUES (16, 'Poha 500g', 'Grocery', 35);
List the columns, then the values in the same order. Text in single quotes, numbers without.
Don’t worry: every Run starts from a fresh copy of the sample database, so you can experiment freely. Add a SELECT after your INSERT to see the new row.
INSERT INTO products
(id, name, category, price)
VALUES (16, 'Poha 500g', 'Grocery', 35);
SELECT * FROM products;
Challenge: A new item on the shelf
The shop starts selling a new item. Insert a row into products with id 16, name Jaggery 1kg, category Grocery and price 70.