Sunday 29 November 2015

UPDATE command in SQL

UPDATE command in SQL is used to update or make the changes to the existing data which is present in the table.
Syntax:
UPDATE <Table_name> set <columnlist>=< value>
Table name can be name of a base table or an updatable view.
WHERE clause is optional: if omitted, named columns are updated for all rows in table. If specified, only those rows that satisfy search condition are updated.
New value must be compatible with data type for corresponding column.
Example:
  1. UPDATE Bank set Customername=”Johny” where Customerid=105
  2. UPDATE Bank set Customername=”ABC”,Balance=7000 where Customerid=105
Query 2 update two columns Customername and Balance at a time. One can update single or multiple columns at a time.




No comments:

Post a Comment