mysql修改表數(shù)據(jù)的語(yǔ)句怎么寫

小新
150
2021-03-23 13:04:32
欄目: 云計(jì)算

mysql修改表數(shù)據(jù)的語(yǔ)句怎么寫

mysql修改表數(shù)據(jù)語(yǔ)句的寫法:

語(yǔ)法格式

update 表名 set 字段名=‘新內(nèi)容’+ where條件

示例

mysql> select* from `runoob_tbl`;

+-----------+--------------+---------------+-----------------+

| runoob_id | runoob_title | runoob_author | submission_date |

+-----------+--------------+---------------+-----------------+

| 1 | 學(xué)習(xí) PHP | 菜鳥教程 | 2018-08-15 |

| 2 | 學(xué)習(xí) MySQL | 菜鳥教程 | 2018-08-15 |

| 3 | JAVA 教程 | RUNOOB.COM | 2018-08-15 |

+-----------+--------------+---------------+-----------------+

3 rows in set (0.04 sec)

mysql> update `runoob_tbl` set `submission_date`='2016-05-06' where `runoob_id`=3;

Query OK, 1 row affected (0.16 sec)

Rows matched: 1 Changed: 1 Warnings: 0

mysql> select* from `runoob_tbl`;

+-----------+--------------+---------------+-----------------+

| runoob_id | runoob_title | runoob_author | submission_date |

+-----------+--------------+---------------+-----------------+

| 1 | 學(xué)習(xí) PHP | 菜鳥教程 | 2018-08-15 |

| 2 | 學(xué)習(xí) MySQL | 菜鳥教程 | 2018-08-15 |

| 3 | JAVA 教程 | RUNOOB.COM | 2016-05-06 |

+-----------+--------------+---------------+-----------------+

3 rows in set (0.04 sec)


0