UPDATE Command:

  • This command is used to update or modify record of the database table.
  • To update any specific record we must use WHERE clause.
  • Using update command without WHERE clause will modify all the records of the database.

Syntax:

UPDATE <table name> SET <column1> = <exp>, <column2> = <exp>,.. <column N> = <exp> WHERE <condition>;

Example:

UPDATE student SET std_name= ‘ABC’ WHERE std_no=1;
UPDATE emp SET salary=salary+2000 WHERE dept=’ACC’;
  • First command will change the name to ABC whose no is 1.
  • Second command will update salary by 2000 of each employee who are working in account department.