Universal Database (netDB2) Introductory Guide


Changing And Deleting Data In A Table

Once the data is entered in the tables , there is a high probability of the user wanting to change the data or even updating it. To implement this facility the user can use the "UPDATE" command. One can use the "DELETE" statement to delete a tuple.

syntax:
  update {tablename} set {current field data} where {condition} 

example:
  update accounts
  set owner_name='fred',
  acc_num=1234
  where acc_code=4538

This command updates the tuple with account code=4538, changing the name to fredand account number to 4538.

syntax:
  delete from {tablename} where {condition} 

example:
  delete from accounts where acc_code=4538  

This command deletes the tuple whose account code is 4538.