The SQL UPDATE Clause is used to modify the existing/update records in a table.

SYNTAX

Where,

  • UPDATE                                             : keyword used to update/modify the column values in table.

  • Table_name                                      : The name of the table from where you want to update the data

  • Column1Name, Column2Name         : The name of the columns of the table which you want to update

NOTE: We must always use the WHERE clause with the UPDATE query to modify the required rows, otherwise all the rows would be affected.

EXAMPLE

Let us consider a demo database with table name Persons.

The above Query updates the City Name where PersonId = 3;

Figure 27.2. UPDATE QUERY & OUTPUT;

 

Figure 27.1. Select * from Persons;

 

PRACTICE YOURSELF 

 

©2020 by Pavan Lalwani. 

  • Udemy
  • Facebook
  • Twitter
  • YouTube
  • Linkedin