SQL Update – SQL TUTORIAL | Software Testing Material

SQL Update Query:

The SQL UPDATE statement is used to update records in a table.

SQL UPDATE Query Syntax:

Here the WHERE clause specifies which record should be updated. If we didn’t mention WHERE clause then all the records will be updated.

Example:

Following statement would update the value in the column name ‘Balls‘ of ‘SCOREBOARD’ table to ‘25‘ where the ‘Playername’ is equal to ‘Dravid.

In the above query, we have specified WHERE Playername=’Dravid’. So only the data related to Playername=’Dravid’ gets updated. If not, all records will be updated.

SQL Update

In the above screenshot, value in the Balls column related to Playername Dravid is 30 based on first SELECT Query and the value in the Balls column related to the same Playername is 25 based on the second SELECT Query.

In the next tutorial, we will see How To DELETE Data in a Table in SQL

Check out the complete SQL Tutorial by clicking on below link:

SQL Tutorial – Complete

Rajkumar SM is a founder of SoftwareTestingMaterial. He is a certified Software Test Engineer by profession and blogger & youtuber by choice. He has an extensive experience in the field of Software Testing. He writes here about Software Testing which includes both Manual and Automation Testing. He loves to be with his wife and cute little kid 'Freedom'.

Leave a Comment

Share via
Copy link
Powered by Social Snap