您好,欢迎访问一九零五行业门户网

如何更改 MySQL 表中行实例的值?

update 命令与 where 子句一起可用于更改行实例的值。基本上,mysql 会根据查询中给出的条件更改值。下面的例子可以演示它
假设我们想在下面给出的“testing”表中将名称从“ram”更改为“mohit” -
mysql> select * from testing;+----+---------+| id | name |+----+---------+| 1 | harshit || 2 | lovkesh || 3 | ram || 4 | gaurav |+----+---------+4 rows in set (0.00 sec)
现在,通过运行以下查询,我们可以将 row 的实例更改为“mohit”,其中它是“ram”。
mysql> update testing set name = 'mohit' where name = ‘ram’;query ok, 1 row affected (0.13 sec)rows matched: 1 changed: 1 warnings: 0mysql> select * from testing;+-----+---------+| id1 | name |+-----+---------+| 1 | harshit || 2 | lovkesh || 3 | mohit || 4 | gaurav |+-----+---------+4 rows in set (0.00 sec)
以上就是如何更改 mysql 表中行实例的值?的详细内容。
其它类似信息

推荐信息