UPDATEemployeeSETname='Gaurav',doj='2010-02- 01'WHEREid=1;QueryOK,1rowaffected(0.06sec)Rowsm"/> UPDATEemployeeSETname='Gaurav',doj='2010-02- 01'WHEREid=1;QueryOK,1rowaffected(0.06sec)Rowsm">

Home  >  Article  >  Database  >  How do we update values ​​in MySQL table?

How do we update values ​​in MySQL table?

王林
王林forward
2023-09-14 18:33:031064browse

我们如何更新 MySQL 表中的值?

With the UPDATE statement and WHERE clause, we can update the value of a single row or multiple rows in the table. MySQL updates the value based on the conditions specified in the WHERE clause. For example, suppose in the "employee" table we want to change the "name" and "doj" of the employee with id 1, then this can be done using the following query -

mysql> UPDATE employee SET name = 'Gaurav', doj = '2010-02-01' WHERE id = 1;
Query OK, 1 row affected (0.06 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from employee WHERE id = 1;
+------+--------+------------+
| id   | name   | doj        |
+------+--------+------------+
| 1    | Gaurav | 2010-02-01 |
+------+--------+------------+
1 row in set (0.00 sec)

The above is the detailed content of How do we update values ​​in MySQL table?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete