Home >Database >Mysql Tutorial >How to increase the original value in mysql
Mysql method to increase the original value: use the update function, the format is [update table name set field name = field name 1 [where statement]].
Mysql original value increase method:
Format:
update 表名称 set 字段名称 = 字段名称 + 1 [ where语句]
For example, in the database There is a student table. If you want to add 1 to the score of the student with ID 1,
update student set score=score+1 where id = 1
If you don't add where, the system will not know which record you want to update, which will cause all the records in the table to be updated. The score is increased by 1, unless of course that's your intention.
More related free learning recommendations: mysql tutorial(video)
The above is the detailed content of How to increase the original value in mysql. For more information, please follow other related articles on the PHP Chinese website!