Insert, Update, Delete

Besides reading data with SELECT, SQL can add, change, and remove rows.

INSERT

Adds a new row. Each example below finishes with a SELECT so you can see the result:

insert a new employee
Result

UPDATE

Changes existing rows. Always pair it with WHERE — without one, every row gets updated:

give Ava a raise
Result

DELETE

Removes rows. Like UPDATE, it needs a WHERE clause or it deletes everything:

remove the sales team
Result
Note: each example above runs against its own fresh copy of the table, so deleting or changing data in one example doesn't affect any other.