Update query in SQL RDBMS database
Update is used for updating the column data in the table of RDBMS database. Update query is DML statement.
It is used to update the exiting column value of any table in RDBMS if you have permission of update to that table.
1. Without WHERE clause in statement it will update all column value of a table. So, use of update is very carefully.
2. You have to give grant privileges to user on table on which you want to give update privileges.
Grant update on table_name to user;
-- For single column
Update table_name set column_name = value1 where column_name2 = value2;
--For multiple column
update table_name set col1 = val1, col2 = val2 where col_name = value;
--For update all rows without WHERE clause
update table_name set col1 =val1 ;
support want to update the first name and last name of the employee having employee id = 2
Update employees set first_name = 'Rakesh', last_name = 'Sharma' where emp_id = 2;