From the course: MySQL Database Administration

Unlock this course with a free trial

Join today to access over 24,500 courses taught by industry experts.

Updating data records

Updating data records

- [Instructor] All right, in this lecture we're going to talk about updating existing records. So now you know how to create tables, you know how to add new records, sometimes you need to update existing records, and MySQL does this using an update statement. Our update statement will always require a set clause, which tells the server which values to set, and then in most cases we'll also include a where clause, which is optional, but highly recommended to specify which records to update. If we don't use a where clause, then the update is going to process on every record in the table. So again, where is optional, but really you're going to use the where almost every time unless you're doing an entire bulk update to every record that you have. So let's jump into Workbench and we can walk through an example. So again, we'll work in our thrift shop schema and I'll say select star from inventory just so that you guys can see everything that's in this table once again. So let's say that…

Contents