The SQL UPDATE general syntax looks like this:
UPDATE Table1
SET Column1 = Value1, Column2 = Value2
WHERE Some_Column = Some_Value
Database: Adventure Works
Schema: Person
Table: Address
Example:
Update Address
set
AddressLine1 ='123 –
jkv road'
The SQL UPDATE clause changes the data in already existing database row(s) and usually we need to add a conditional SQL WHERE clause to our SQL UPDATE statement in order to specify which row(s) we intend to update.
If we
don’t specify a WHERE clause in the SQL expression above, all Address AddressLine1
will be updated to '123 – jkv road', so be careful with the SQL
UPDATE command when you use.
We can update several database table rows at once, by using the SQL WHERE
clause in our UPDATE statement. For example if we want to change the PostalCode for
all Address with City 'Bothell' (we have 2 in our example Address
table), we need to use the following SQL UPDATE statement: Update Address set PostalCode = 98011 Where City = 'Bothell'
No comments:
Post a Comment
Thank You !!!!