How to Update Query in SQL

preview_player
Показать описание
Follow this step by step easy tutorial to learn how to use Update query in SQL together with where clause.

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:
Update EMP
Set Sal=3500
Where EMPNO=7566
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.
Рекомендации по теме
Комментарии
Автор

This is the best tutorial I have ever seen. you packed 10 minutes of info into 1.

andrewc
Автор

Perfect and straight to the point! Thanks!

syncaccount
Автор

Well. But I have my sql does not performing UPDATE operation why so pls help

AthumanAthuman-bb
Автор

hey i really liked your tutorial its very helpful great work keep it up

cheers

asifshaikh
join shbcf.ru