Difference between revisions of "Update Command"

From rbachwiki
Jump to navigation Jump to search
(Created page with "= Update Command = ''' Used to change the contents of existing rows ''' * The UPDATE clause identifies the table containing the records to be changed. * The SET clause ident...")
 
Line 2: Line 2:
''' Used to change the contents of existing rows  '''
''' Used to change the contents of existing rows  '''
* The UPDATE clause identifies the table containing the records to be changed.
* The UPDATE clause identifies the table containing the records to be changed.
* The SET clause identifies the columns to be changed and the new values to
* The SET clause identifies the columns to be changed and the new values to be assigned to these columns.
be assigned to these columns.
* The optional WHERE clause identifies the exact records to be changed by the UPDATE command. If the WHERE clause is omitted, the column specified in the SET clause is updated for all records in the table.
* The optional WHERE clause identifies the exact records to be changed by the
 
UPDATE command. If the WHERE clause is omitted, the column specified in
UPDATE acctmanager
the SET clause is updated for all records in the table.
SET amedate = '01-AUG-09'
WHERE amid = 'J500';
 
== Change multiple records that match a criteria ==
''' All records that have NE and NW will be changed to W'''
UPDATE acctmanager
SET region = 'W'
WHERE region IN ('NE', 'NW')
 


[[#Select Command|Back To Top]]-[[Main_Page| Home]] - [[Oracle_SQL|Category]]
[[#Select Command|Back To Top]]-[[Main_Page| Home]] - [[Oracle_SQL|Category]]

Revision as of 13:44, 18 October 2017

Update Command

Used to change the contents of existing rows

  • The UPDATE clause identifies the table containing the records to be changed.
  • The SET clause identifies the columns to be changed and the new values to be assigned to these columns.
  • The optional WHERE clause identifies the exact records to be changed by the UPDATE command. If the WHERE clause is omitted, the column specified in the SET clause is updated for all records in the table.
UPDATE acctmanager
SET amedate = '01-AUG-09'
WHERE amid = 'J500';

Change multiple records that match a criteria

All records that have NE and NW will be changed to W

UPDATE acctmanager 
SET region = 'W'
WHERE region IN ('NE', 'NW')


Back To Top- Home - Category