UPDATE statement in SQL

 UPDATE


The UPDATE statement is used to update existing records in a table.
The syntax is as follows:

UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value

Note!: Notice the WHERE clause in the UPDATE syntax. The WHERE clause specifies which record or records that should be updated. If you omit the WHERE clause, all records will be updated!

Example:

update CUSTOMER set AreaCode=46 where CustomerId=2

Before update:

Algae Services, Algae Study, Algae Education Services

After update:

Algae Study, Algae Services, Algae Education Services
If you don’t include the WHERE clause the result becomes:

Algae Study, Algae Services, Algae Education Services

→ So make sure to include the WHERE clause when using the UPDATE command!

Update Data in the Designer Tools:

The same way you insert data you can also update the data. Right-click on the specific table and select “Edit Top 200 Rows”: 
Algae Study, Algae Services, Algae Education Services
Then you can change your data:

Algae Study, Algae Services, Algae Education Services



No comments:
Write comments

Please do not enter spam links

Meet US

Services

More Services