UPDATE Statement MYSQL

Updating the data is often required frequently and UPDATE statement can be used to modify the existing records in a table.

Let’s see how we can update the records address which has the city as ‘Bengaluru’ to ‘Bangalore’


Syntax:

UPDATE table_name
SET column1 = value1, column2 = value2, …
WHERE condition;

Query:

UPDATE `persons` SET City='Bangalore' WHERE City='Bengaluru'


Output:

UPDATE Statement Example

As you see the 1 record matched the provided condition and same is updated with new value for city column that is ‘Bangalore’

Tester Usage Tips:

  • Update table records with condition and validate test cases
  • Update table to validate data size min max conditions