Update Query in MySQL || MySQL Update Query

MySQL Update Data


When you work with the databases, you need to make some changes into the existing data. So, If you want to modify the existing data in the table then,"UPDATE" statement is used for this.

Update Query in MySQL:

UPDATE table_name
SET field1='value',
WHERE condition;


  1. table_name is the name of the table which you want to modify.
  2. field1 and field2 is the name of columns in the table.
  3. value1 and value2 is the values of fields1 and fields2 respectively.
  4. Condition is the specified condition through which you define the particular rows in which you want to make changes. If you make forget the WHERE condition, it will update all rows into the table.

MySQL Update Data Example:

$conn=mysqli_connect("localhost","root","","databasename"); // create connection wit the database
$sql="UPDATE students
SET division='First'
// students is table name and division is field name
$result= mysqli_query($conn,$sql);
echo "Data Updated Successfully";

Best WordPress Hosting


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price

Leave a Reply

    Waiting for your comments