From the course: Learning SQL Programming

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Modify data in a table

Modify data in a table - SQL Tutorial

From the course: Learning SQL Programming

Start my 1-month free trial

Modify data in a table

- [Instructor] Data in the database can be modified using the update keyword. Update is useful where we want to change information that's already there, rather than adding new records with different information. To update information, we have to tell the database which table we're using, what fields to update with what values, and optionally, a where clause to specify how to find records to update. If you leave off a where clause, the change will apply to all the records in the whole table. So be careful with that. Let's say we were contacted by one of our participants who noticed they had entered their name incorrectly. Carlos Morrison of Houston, Texas accidentally typed too many Rs. Since Carlos has already taken our quiz and already provided other information, it's best to just go in and change the last name field rather than delete Carlos and add a new, correct record. I'll write an update statement to change the last name to Morrison, spelled correctly, for the first name…

Contents