An Update query in SQL is used to modify the present records in the existing table.
A “Where” clause has to be used with the Update query to specify the row which has to be modified, otherwise all the rows in the table will get effected.
Step 1- Displaying Employee Table
First of all, let us fetch all records from the table and after that we will update the table by Update query of SQL.
For that simply write:
Select * from EMP
Step 2-Update Query
Now , if we want to update the salary for Jones, first we will use Update keyword along with the particular table name which is EMP in our case, then we have to specify its employee Number in the where clause.
Together the query in SQL would be something like this:
Execute it by pressing F5.
Step 3-Done with Update
Now fetch the data from employee table again and see that that salary of Employee No. 7566 has been updated to the amount specified earlier in Update query of SQL
And this is how we can use Update query in SQL.