MySQL Update Data

MySQL Update Data


In previous tutorials we have to learn about how to create database,create table,Insert data,Insert multiple data,data fetching from SELECT command .Now we have to learn how to update data in our records
The UPDATE command used to update the records in database

UPDATE command Syntax :
    UPDATE table_name
    SET column1=value, column2=value2,...
    WHERE some_column=some_value 

In this syntax we can see WHERE Clause in UPDATE command Syntax.WHERE clause to check which record or records that should be updatad .

Given below a table "new_db" :

                

In this table we can using UPDATE command to update from (lastname="designing") to  lastname="house".

Example (MySQLi Object-oriented) :

 

Example (MySQLi Procedural):

 

Example (PDO) :

 

Final output : After the record is updated, the table will look like this: