Updating statement: – Sometimes it is necessary to change or edit data in existing table. Updating statement is used to change row according to condition or without any condition. This statement is also useful to update records with help of another table. Syntax of the update statement is –

                Update <Table Name> set <Column1=Expression,Column2=Expression, _ _ _ > (Where <Test Expression>);

Here, column1, column2, _ _ _ are list of column names and expression may be constant or may be calculated value. We can use some test expression after where clause. This clause it optional and it may or may not be use with update statement. Some example of update statement are as follows –

                Update company set salary=salary*1.2;

In case of above example, salary column value enhances to all rows of table company with 20%.

                Update company set salary=salary*1.2 where cname=’Telco’;

In case of above example, salary column enhances to 20% of only those employee from table company which cname=Telco.

                Update company set salary=salary+100 where ename=’Vijay’ and ename in(select e1.ename from employee e1 where e1.city=’Chennai’);

In case of above example, salary column enhances to Rs 100 from table company which ename is vijay and same name match with ename column from table employee witch city=Chennai.