Basic SQL Update Command on Oracle Database

UPDATE is one of the DML (Data Manipulation Language) commands in Oracle DBMS. Like the INSERT command, to complete the command and make the data permanently modified the UPDATE command ends with the COMMIT command.
The UPDATE command can change one or more values from a data record in a table or can change some values from multiple record data in the table. The data modification using UPDATE command require a unique attribute value to indicate which records will be changed, usually the primary key attribute specified in the WHERE clause. If it does not include the marker attribute then what happens is the entire record data in the table will change.

Format :
UPDATE <tabel_name>
SET <attribute1> = <value1>[, <attribute2> = <value2>]
WHERE <key_attribute> = <value>;

Tuser
-------------------------------------
ID         NAME                PHONE 
-------------------------------------
1          One                  1111111
2          Two                  2222222
3          Three                3333333
-------------------------------------

Example:
If we will change the phone belonging to One that 1111111 become 8888888, UPDATE command used is :

UPDATE tuser
SET phone=8888888
WHERE name=’One’;

COMMIT;

TUSER table records now should be like this
-------------------------------------
ID         NAME                PHONE 
-------------------------------------
1          One                  8888888
2          Two                  2222222
3          Three                3333333

-------------------------------------

No comments

Powered by Blogger.