From the course: Microsoft SQL Server 2019 Essential Training

Unlock the full course today

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

Update records in a table

Update records in a table - SQL Server Tutorial

From the course: Microsoft SQL Server 2019 Essential Training

Start my 1-month free trial

Update records in a table

- Records in your data tables will occasionally need to be modified. To do this with an SQL query, you're going to use an update statement. Let's start up a new query window so we can take a look at this and I want to make sure that I'm targeting the Landon Hotel database in this drop down menu. Now the first thing I want to do is take a look at all of the different records that are in the room reservations table. If I execute the query, we'll see that we have two reservations currently stored in the database. Guest ID number 1,000 belongs to our friend, Katherine Reid again. Let's suppose that she called the hotel and she wants to check in a day earlier. To modify her reservation, we're going to write a quick update statement. This begins with the key word update and the table that we want to update, which is room reservations. Then I'll use the set key word to say that I'm going to set the check in date to a new value. To do that, I'll say that it's equal to, and then because it's a…

Contents