ZBLOG

mysql update

The UPDATE statement in MySQL is used to modify existing records in a table. The basic syntax of the UPDATE statement is as follows:

  1. UPDATE table_name
  2. SET column1=value1, column2=value2, ...
  3. WHERE condition;

In this syntax:

  • table_name is the name of the table you want to update.
  • column1, column2, etc. are the names of the columns you want to update.
  • value1, value2, etc. are the new values you want to set for those columns.
  • condition specifies which rows should be updated. If omitted, all rows in the table will be updated.

For example, suppose we have a table named “employees” with columns “id”, “name”, and “salary”. We can use the following UPDATE statement to increase the salary of all employees whose id is greater than 100:

  1. UPDATE employees
  2. SET salary=salary*1.05
  3. WHERE id>100;

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=4759

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?