Top Menu

Search This Blog

SQL UPDATE command

The UPDATE command is used to update existing records in a table.

Syntax:

without a where clause
The WHERE clause specifies which records that should be updated. If you can not use the WHERE clause, all records will be updated!
 UPDATE table_name
 SET column_1=value_1,column_2=value_2,column_3=value_3

With a where clause
The WHERE clause specifies which records that should be updated.update record by conditionally.
UPDATE table_name
SET column_1=value_1,column_2=value_2,column_3=value_3,...
WHERE some_column_name=some_value

As you see, we have like this "Candidate" table.















Example:

with where clause

update CANDIDATE set CandidateNumber='1269911' where FirstName='Harsh'

Output:











without where clause(Be careful when you can not use the WHERE clause, ALL records will be updated)

 update CANDIDATE set Phone='12699112' 

Output:












Post a Comment

Designed by OddThemes | Distributed By Gooyaabi Templates