From the course: SQL Server 2014 Essential Training

Unlock the full course today

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

UPDATE statements

UPDATE statements - SQL Server Tutorial

From the course: SQL Server 2014 Essential Training

Start my 1-month free trial

UPDATE statements

- In this section, I'd like to look at using a SQL statement to modify one or more existing records in the database. For this example, again, we'll work with HumanResources.Department, so let's take a look at the data in there first. I'll do a New Query with a SELECT store FROM [HumanResources] . [Department] and we see that the very first record there is the Engineering Department which is in a group called Research and Development. Let's say, hypothetically, we wanted to change that, and we wanted to change the Engineering Department to be in a different group. We can issue a SQL statement that will update that one record, it will modify the record. So to do this, I'll open up a New Query, I'll use the keyword UPDATE, and then the name of the table I'm interested in updating, which is [HumanResources] . [Department], then I need to use the keyword SET, and after SET I list the name of the column I would like to change, which, in this case is GroupName. I'd like to set the GroupName…

Contents