...

Database Managment - Oracle

Back to Course

Lesson Description


Lession - #1423 Oracle UPDATE Statement


Oracle UPDATE Statement

In Oracle, UPDATE explanation is utilized to refresh the current records in a table. You can refresh a table in 2 ways.
Syntax:

UPDATE table  
SET column1 = expression1,  
    column2 = expression2,  
    ...  
    column_n = expression_n  
WHERE conditions;  

Update Table by selecting rocords from another table

Syntax:

UPDATE table1  
SET column1 = (SELECT expression1  
               FROM table2  
               WHERE conditions>
WHERE conditions;


Oracle Update Example: (Update single column>


UPDATE suppliers  
SET supplier_name = 'Kingfisher'  
WHERE supplier_id = 2;  


Oracle Update Example: (Update multiple columns>

The following example specifies how to update multiple columns in a table. In this example, two columns supplier_name and supplier_address is updated by a single statement.

UPDATE suppliers  
SET supplier_address = 'Agra',  
    supplier_name = 'Bata shoes'  
WHERE supplier_id = 1;