Home › Learn › SQL › Changing data, and the report

INSERT

Lesson 21 of 26. Add rows.

INSERT INTO products (name, category, price, stock) VALUES ('Mouse', 'hardware', 24.50, 30); adds one row. Listing the columns lets the database fill the rest: id is an INTEGER PRIMARY KEY, so SQLite assigns the next number. Several rows can go in one statement by separating the value groups with commas.

From here on the checks look at the state of the table after your statements run, using a probe query, rather than at what your statements return.

INSERT INTO employees (name, dept, salary, manager_id) VALUES ('Priya', 'Support', 4500, 6);

Your task

Add a product named Mouse in the hardware category costing 24.50 with 30 in stock.

Hint 1

VALUES ('Mouse', 'hardware', 24.50, 30)

Show the solution
INSERT INTO products (name, category, price, stock) VALUES ('Mouse', 'hardware', 24.50, 30);

    Runs SQLite compiled to WebAssembly in this tab; the database is rebuilt before every run.