Skip to main content

Update command in SQL

How to use UPDATE Command in SQL

In this post, you will learn how to use UPDATE command in SQL.

UPDATE command is used to update existing record in table. Update command is always used with WHERE clause. If you don't use WHERE Clause, all record will be updated in table so while using UPDATE command, you must be carefull.

Syntax of UPDATE command:

UPDATE Table_Name  SET Column_Name='New_Values' 
WHERE Column_Name='Old_Values' ;


Suppose we have source table: 



Emp_ID
Emp_Name
Emp_Age
Emp_Salay
1
Mohan
25
25000
2
Rakesh
25
25000
3
Ram
25
25000


Now i'm going to update Emp_Name: Mohan to "Mahesh". Now use below code to Update existing record

UPDATE EMP 
SET Emp_Name='Mahesh' WHERE Emp_Name='Mohan';

Now after executing this code, you will get below results:

Emp_ID
Emp_Name
Emp_Age
Emp_Salay
1
Mohesh
25
25000
2
Rakesh
25
25000
3
Ram
25
25000


Update Multiple Values by using below command

UPDATE EMP 
SET Emp_Name='Mahesh' , Emp_Age=30, Emp_Salary=30000 WHERE Emp_ID=1;

Now Output will be :

Emp_ID
Emp_Name
Emp_Age
Emp_Salay
1
Mohesh
30
30000
2
Rakesh
25
25000
3
Ram
25
25000


Popular posts from this blog

How to analyze a JMeter summary report?

  A  Jmeter  Test Plan must have listener to showcase the result of performance test execution. Listeners capture the response coming back from Server while Jmeter runs and showcase in the form of – tree, tables, graphs and log files. It also allows you to save the result in a file for future reference. There are many types of listeners Jmeter provides. Some of them are: Summary Report, Aggregate Report, Aggregate Graph, View Results Tree, View Results in Table etc. Here is the detailed understanding of each parameter in Summary report. By referring to the figure: Label : It is the name/URL for the specific HTTP(s) Request. If you have selected “Include group name in label?” option then the name of the Thread Group is applied as the prefix to each label. Samples : This indicates the number of virtual users per request. Average : It is the average time taken by all the samples to execute specific label. In our case, the average time for Label 1 is 942 milliseconds & to...

Tic Tac Toe game in Python

  It’s no doubt, you must have played Tic Tac Toe in your school days and every one of us loves to play the game. You will be surprised to know that the game of Tic Tac Toe is known to exist since ancient Egypt times. With this Python project by TechVidvan, we are going to build an interactive game of Tic Tac Toe where we’ll learn new things along the way. What is Tic Tac Toe? Tic Tac Toe is one of the most played games and is the best time killer game that you can play anywhere with just a pen and paper. If you don’t know how to play this game don’t worry let us first understand that. The game is played by two individuals. First, we draw a board with a 3×3 square grid. The first player chooses ‘X’ and draws it on any of the square grid, then it’s the chance of the second player to draw ‘O’ on the available spaces. Like this, the players draw ‘X’ and ‘O’ alternatively on the empty spaces until a player succeeds in drawing 3 consecutive marks either in the horizontal, vertical or di...

MANUAL TESTING(Agile) Interview Question

Some important questions for 2-3 years of exprinced in MANUAL TESTING.(Agile) 1. What is Agile testing. 2.what is Product backlog. 3 what is sprint backlog. 4. Grooming and Retrospection. 5. What is role of product owner and scrum Master. 6. Agile testing metholidies. 7. What is sanity testing. 8. What is smoke testing. 9. When smoke and sanity testing is done. 10. What is Regression testing. 11.What is difference between component testing and unit testing. 12. Priority and severity. 13. Real time example of low priority and high severity. 14. Real time example of high priority and low severity. 15. Different between build and release. 16. Important components in test plan. 17. Testing and Retesting difference. 18. Bug life cycle. 19. What is deferred and rejected. 20. Authorization and authentication. 21.  BVA ( Boundary value Analysis). 22. What is minor difference between Monkey testing and ad-hoc testing. 23. What is view. 2...