Unsafe query: ‘Update‘ statement without ‘where‘ updates all table rows at once

简介: Unsafe query: ‘Update‘ statement without ‘where‘ updates all table rows at once
-- Unsafe query: 'Update' statement without 
  'where' updates all table rows at once

没有任何约束的情况下,当前指定数据表中的所有数据行全部执行修改操作。这很危险!

一定要带有where条件约束:

update person set id = 10;
-- OK
update person set id = 10 where name = 'java';

可以同时修改多个数据,不同的字段赋值操作使用 逗号隔开

update person set id = 20, age = 10, salary = 200000.01 where name = 'java';
目录
相关文章
|
9月前
【开发专题_02】Executing an update/delete query
【开发专题_02】Executing an update/delete query
89 0
|
关系型数据库 MySQL
深入理解SELECT ... LOCK IN SHARE MODE和SELECT ... FOR UPDATE
深入理解SELECT ... LOCK IN SHARE MODE和SELECT ... FOR UPDATE
333 0
|
SQL 存储 关系型数据库
MySQL中count(*)和information_schema.tables中的table_rows值不相同
MySQL中count(*)和information_schema.tables中的table_rows值不相同
459 0
解决sql update 1292 - Truncated incorrect DOUBLE value:
出现这种错误,我属实焦头烂额了一会儿,这个错误基本可以分为以下两种情况: 一:你的字段类型是varchar,但是你这样进行操作,是不对的, UPDATE StuCose SET Cno=60 应该是: UPDATE StuCose SET Cno='60' 二:你更新操作进行子查询时,需要的两个表的相同的字段的类型不同,比如你的cose表中的Cno是int类型, 但是你的stucose表中是varchar类型 ,这个时候类似这样进行了子查询的update就会报错 UPDA.
682 0
|
关系型数据库 MySQL 数据库
MySQL问题解决:Cannot delete or update a parent row: a foreign key constraint fails
MySQL问题解决:Cannot delete or update a parent row: a foreign key constraint fails
1576 0
|
SQL Java 数据库连接
JPA异常:Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
JPA异常:Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
2195 0
|
关系型数据库 数据库 PostgreSQL
【DB吐槽大会】第70期 - PG 不支持update | delete skip locked, nowait语法
大家好,这里是DB吐槽大会,第70期 - PG 不支持update | delete skip locked, nowait语法
|
Java
错误Batch update returned unexpected row count from update [0]; actual row count: 0;
错误Batch update returned unexpected row count from update [0]; actual row count: 0;   把开发过程中碰到的BUG累积下来也是一笔财富。
3773 0
错误Batch update returned unexpected row count from update [0]; actual row count: 0;