|
The Update command is used to make changes to records in tables. The general syntax is as under.
Syntax:
UPDATE table_name
SET Column1 = Value1, Column2 = Value2,…
WHERE Some_Column = Some_Value
Example:
Table(empinfo)
|
FirstName
|
LastName
|
Email
|
DOB
|
Phone
|
|
Ajay
|
Rathor
|
ajayrathor@studiesinn.com
|
08-24-1986
|
349 773-4115
|
|
David
|
Fernandas
|
davidfernandas@studiesinn.com
|
04-16-1977
|
713 155-4320
|
|
Steve
|
Martin
|
smart.steve@studiesinn.com
|
08-04-1988
|
362 497-9345
|
UPDATE empinfo
SET Phone = '421 873-1432'
WHERE FirstName = 'Steve'
If we don’t specify a WHERE clause in the SQL expression above, all employee’s Phone will be updated to '421 873-1432', so be careful with the SQL UPDATE command usage. |