Home

Records Operations: Updating a Record

 

Introduction

Updating a record consists of changing or more of its values. To support this operation, the SQL provides the UPDATE keyword you can use in the following formula:

UPDATE TableName
SET ColumnName = Expression
 

Examples

Here is an example:

USE VideoCollection;
GO
UPDATE Videos
SET Rating = 'R';
GO

Here is an example:

UPDATE TableName
SET ColumnName = Expression
WHERE Condition(s)

Here is another example:

UPDATE Videos
SET YearReleased = 1996
WHERE Director = 'Rob Reiner';

Here is another example:

UPDATE Videos
SET YearReleased = 1996
WHERE VideoID = 5;
GO

Here is an example:

UPDATE Videos
SET Director = 'Jonathan Lynn'
WHERE VideoTitle = 'The Distinguished Gentleman';

Home Copyright © 2009-2011 FunctionX.com