If we want to modify an existing record in the table, then the update statement is the one we should go for.
MySQL Update Syntax
UPDATE table_name
SET column1 = value, column2 = value, ...
WHERE condition;
MySQL Update Example
Let us use the info table for this example demonstration.
Now let us modify the city of Aldo to Chennai instead of Bombay. Let us see how we can do that.
UPDATE info
SET city = 'Chennai'
WHERE Name = 'Aldo';
We can see here that we have changed the city of Aldo to Chennai using the update.
NOTE:
UPDATE info
SET city = 'Chennai'
Without a where statement in the update statement query, this above query will change the record of everything to Chennai regardless of the where statement.
This is how we can use the update statement effectively.