Quick answer
INSERT adds new rows.
UPDATE changes existing rows.
DELETE removes rows.
These are the main SQL commands used to modify data inside a table. They are essential, but they also require more caution than a normal SELECT query because they change the database.
UPDATE and DELETE. A missing WHERE clause can affect every row in the table.
In this guide
Sample table
Imagine you have a table called employees:
| employee_id | name | department | salary | city |
|---|---|---|---|---|
| 1 | Ana | Sales | 62000 | Chicago |
| 2 | Ben | IT | 78000 | Dallas |
| 3 | Chris | HR | 56000 | Chicago |
How INSERT works
INSERT adds a new row to a table.
INSERT INTO employees (employee_id, name, department, salary, city) VALUES (4, 'Dana', 'IT', 85000, 'Denver');
That query adds a brand-new employee row for Dana.
Why listing columns is a good habit
You can sometimes write an INSERT without explicitly listing column names, but beginners should avoid that. Listing the columns makes the query easier to read and much safer if the table structure changes later.
INSERT INTO unless you have a very specific reason not to.
What the table would look like after the INSERT
| employee_id | name | department | salary | city |
|---|---|---|---|---|
| 1 | Ana | Sales | 62000 | Chicago |
| 2 | Ben | IT | 78000 | Dallas |
| 3 | Chris | HR | 56000 | Chicago |
| 4 | Dana | IT | 85000 | Denver |
How UPDATE works
UPDATE changes values in existing rows.
UPDATE employees SET city = 'Austin' WHERE employee_id = 2;
This changes Ben’s city from Dallas to Austin.
You can update other columns too
UPDATE employees SET salary = 60000 WHERE name = 'Chris';
This changes Chris’s salary to 60000.
You can update multiple columns at once
UPDATE employees
SET department = 'Finance',
city = 'Boston'
WHERE employee_id = 1;
UPDATE is powerful because it can change many rows at once, but that is also what makes it dangerous.
How DELETE works
DELETE removes rows from a table.
DELETE FROM employees WHERE employee_id = 3;
This removes Chris’s row from the table.
Unlike UPDATE, which changes the values inside a row, DELETE removes the whole row entirely.
UPDATE. If you want the row gone, use DELETE.
Why WHERE matters
The WHERE clause tells SQL which rows should be updated or deleted. Without it, SQL may apply the command to every row in the table.
Dangerous UPDATE example
UPDATE employees SET city = 'Miami';
That would change the city for every employee.
Dangerous DELETE example
DELETE FROM employees;
That would delete every row in the table.
WHERE clause is one of the most common and costly beginner mistakes in SQL.
Safe workflow before changing data
A smart habit is to preview the rows first with a SELECT query using the same filter you plan to use in your UPDATE or DELETE.
SELECT * FROM employees WHERE employee_id = 2;
If that preview shows the exact row you want, then you can safely move on to:
UPDATE employees SET city = 'Austin' WHERE employee_id = 2;
WHERE clause.
SELECT.
UPDATE or DELETE.
Common mistakes
- Forgetting the
WHEREclause in anUPDATE - Forgetting the
WHEREclause in aDELETE - Inserting values in the wrong column order
- Trying to insert a duplicate primary key value
- Updating more rows than intended because the filter was too broad
- Deleting a row when you really only meant to change one column
Practice questions
employee_id = 3.
SELECT query you would run first before updating a row.
Bottom line
INSERT adds rows.
UPDATE changes rows.
DELETE removes rows.
These commands are core SQL skills, but they should always be used carefully because they change the real data in your tables.
Related SQL tutorials
Start here for all SQL topics and tutorials.
Learn how to read data before you start changing it.
Understand how filtering works before using UPDATE or DELETE safely.
Practice beginner-friendly SQL problems across common query patterns.