← Back
LESSON 14
SQL (Core) - Updating rows
Prereq: None | Progress: 0%
Course Syllabus
Lesson 0 📖 What is SQL? Lesson 1 📖 SELECT queries 101 Lesson 2 📖 Queries with constraints (Pt. 1) Lesson 3 📖 Queries with constraints (Pt. 2) Lesson 4 📖 Filtering & sorting results Review 1 📖 Simple SELECT Queries Lesson 6 📖 Multi-table queries with JOINs Lesson 7 📖 OUTER JOINs Lesson 8 📖 A short note on NULLs Lesson 9 📖 Queries with expressions Lesson 10 📖 Queries with aggregates (Pt. 1) Lesson 11 📖 Queries with aggregates (Pt. 2) Lesson 12 📖 Order of execution of a Query Lesson 13 📖 Inserting rows Lesson 14 📖 Updating rows Lesson 15 📖 Deleting rows Lesson 16 📖 Creating tables Lesson 17 📖 Altering tables Lesson 18 📖 Dropping tables Lesson 19 📖 Subqueries & Nested Queries Lesson 20 📖 Set Operations Summary 🎓 Course Completion
SQL Lesson 14: Updating rows
Database records frequently change as new information becomes available. In SQL, you modify existing row data using the UPDATE statement.
Update Syntax & Safe Filters
The UPDATE query requires a table name, a SET clause specifying new values, and a critical WHERE constraint:
UPDATE table_name
SET column1 = value1, column2 = value2
WHERE condition; ⚠️ Important: Always verify your WHERE condition before running an UPDATE query. Without a WHERE clause, SQL will overwrite column values for every single row in the entire table!
🗄️ Schema Explorer SELECTABLE
› movies
|
🎯 Exercises Checklist:
☐ 1. The director for A Bug's Life is incorrect, it was actually directed by John Lasseter
☐ 2. The year Toy Story 2 was released is incorrect, it was released in 1999
☐ 3. Both the title and director for Monsters, Inc. are correct, but update the director Dan Scanlon to Daniel Scanlon
⚡ Practice Console
💡 Hint:
Loading hint...
🔑 Solution SQL:
SELECT * FROM movies; Data Output
No results. Run query to fetch data.