From the course: MySQL Essential Training

Unlock this course with a free trial

Join today to access over 23,700 courses taught by industry experts.

Updating data

Updating data

- [Bill] Hi, I am Bill Weinman. The update statement is used to change data in existing rows in a table. This lesson, we're using the scratch database. So I'll type use scratch and that opens the scratch database for our use. And when I SELECT * FROM customer, you notice that we still have the data from our previous lesson on inserting rows. And we're going to use this data for this lesson. So I can say SELECT * FROM customer WHERE name LIKE and then Jimi with a percent symbol and close my single quotes. And when I execute this, we notice we just get that one row with the ID five and the name Jimi Hendrix. So the where like clause allows us to filter a row based on a string. The percent symbol is used as a wild card in SQL. So we can say WHERE name LIKE Jimi% and it gives us any rows where the name column string starts with the characters J-I-M-I. And so we just get that one row. We can use this same WHERE LIKE clause in an UPDATE statement, right? So I'm going to go ahead and copy…

Contents