From the course: MySQL Essential Training (2019)

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Updating data

Updating data

- [Instructor] The update statement is used to change data in existing rows in a table. For this lesson, we'll use the scratch database. Here in MySQL Workbench, I'm connected with my admin connection and I'm just going to type use scratch and execute and we're now using the scratch database. So, if I select asterisk from customer and execute, you see we have these five rows. This includes the two rows that we added in the previous lesson on the insert statement. Now, if I use a where clause in my select statement, I say where name like and Jimi with a percent symbol. The percent is a wildcard in the like clause and it means any series of characters, so zero or more of any character. And so when I execute this statement, it only returns the rows where the name column begins with the characters J-I-M-I. Now I can use that same where clause in an update statement, so instead of select asterisk from, I can say update customer and then I can set values with the set clause. Set address…

Contents