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 - SQL Server Tutorial
From the course: Microsoft SQL Server 2019 Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Understand the role of T-SQL1m 59s
-
(Locked)
Use the T-SQL editor6m 4s
-
(Locked)
Create a table with T-SQL5m 28s
-
(Locked)
Add data to a table3m 41s
-
(Locked)
Retrieve records with SELECT3m 28s
-
(Locked)
Filter returned results with WHERE1m 51s
-
(Locked)
Sort records2m 42s
-
(Locked)
Delete records from a table3m 32s
-
(Locked)
Update records in a table3m 4s
-
(Locked)
Join related tables5m 1s
-
(Locked)
LEFT JOIN and RIGHT JOIN2m 16s
-
(Locked)
Remove a table from the database4m 6s
-
(Locked)
-
-
-
-
-
-