Oracle query for UPDATE table data
To update existing records in a table UPDATE statement is used.
Oracle UPDATE Syntax
SET column1 = value1,
column2 = value2,
column_n = value_n
The WHERE clause specifies which record or records that should be updated. If you not write the WHERE clause query, all records will be updated.
Oracle Update Example: (Update single column)
SET student_name = 'Mitra'
WHERE student_id = 2;
This example will update the student_name as "mitra" where "student_id" is 2.
Oracle Update Example: (Update multiple columns)
SET student_address = 'Kendrapara',
student_name = 'Mitrabhanu'
WHERE student_id = 1;
Oracle Update Example: (By selecting records from another table)
SET name = (SELECT student_name
WHERE student.student_name = students.name)
WHERE age < 30;