Skip to content
Guest
Learn SQL · Course Syllabus Show lessons
Modifying Data · 8 min read · Beginner

INSERT, UPDATE & DELETE Safely

Add new rows with INSERT INTO, modify existing records with UPDATE ... SET ... WHERE, and remove rows safely with DELETE FROM.

What you'll learn

  • Insert new records with explicit column lists
  • Update specific rows cleanly using UPDATE ... SET ... WHERE
  • Always test a WHERE clause with SELECT before running UPDATE or DELETE

Modifying data is where SQL mistakes can be costly. One golden rule prevents disasters: never run UPDATE or DELETE without a WHERE clause unless you truly intend to overwrite or wipe the entire table!

Fill-in-the-Blank Exercise

Safe UPDATE Statement

Update the score to 100 specifically for the learner with id = 2.

 learners
 score = 100
 id = 2;

Try It Yourself

Notice how we insert a new row, update one row, and then SELECT the final table state:

SQLINSERT, UPDATE & Inspect Results
Query Result (In-Browser SQLite)

Click Run SQL to execute this query against a live in-browser SQLite database.

Check Your Understanding

Score: 0 / 1

1. What happens if you run `DELETE FROM tasks;` without a WHERE clause?

Study Workspace

Finished this lesson?

Your progress is saved locally in your browser, no account needed.

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind