Mysql addition, deletion, modification and query update records
Update record
Update data We have already said. When you need to modify content, modify bank card balances, or modify equipment information, you need to use update and modify statements.
The basic syntax of the modification (also called update) statement is as follows:
Category
Detailed explanation
Basic syntax
update table name set field 1=value 1, field 2=value 2, field n=value n where conditions
Example
update money set balance=balance-500 where userid = 15;
Example description
Modify the money table and change The balance balance is reduced by 500. The required userid is 15
Suppose we have the following table, the table structure is as follows:
userid
username
balance
##1
王宝强
50000.00
2
黄晓明
150000000.00
##15
马云
15000.00
16
Chen He
1234131.00
mysql> select * from emp where deptno=15; +------+----------+----------+ | userid |username| balance | +------+----------+----------+ | 15 | 马云 | 15000.00 | +------+-------+-------------+ 1 row in set (0.00 sec)
The courseware is not available for download at the moment. The staff is currently organizing it. Please pay more attention to this course in the future~
Students who have watched this course are also learning