From the course: SQL for Testers

Unlock the full course today

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

Update existing entries in a table

Update existing entries in a table - SQL Tutorial

From the course: SQL for Testers

Start my 1-month free trial

Update existing entries in a table

- [Instructor] You know how to add new entries to a table, but what if you wanted to modify existing entries? Let's say for example, that you wanted to see what would happen if the name of one of your items was really long. So let's modify the name of this second item here and see what happens if we make it have a really long name, instead of just saying women's t-shirt. In order to update existing entries, we use the aptly named update command. So update needs to know what table to update. So we'll say products, and now we can set values. So we'll use the set keyword to do that, and we only want to do it for the column name. We want to change the name of our product, and let's just give it a name of something like very, very long name to see what happens with long names, something like that. Now we don't want that to change for all of the products in our table, so let's tell it that we want it to do it for the one where the product ID is equal to two. So now let's run this query, and…

Contents