prevent delete * from table unless primary key specified(除非指定了主键,否则防止从表中删除 *)
问题描述
除非指定主键,否则我想阻止用户使用从表中删除 *,我们的团队成员之一经常使用从 table_name 中删除 *",我想防止将来发生这种情况.
I want to prevent user from using deleting * from table unless primary key specified, one of our team member accendently used "delete * from table_name" i want to prevent such scenarios in future.
推荐答案
Would 安全更新 对您来说可行吗?这是一个您可以在命令行、选项文件中启用的选项,或者在 SQL 代码中设置一个变量,以防止在没有 where
子句的情况下进行更新和删除,该子句包括定义要更改的行的键列.
Would safe updates be viable for you? This is an option you can enable on the command line, in the option file or set a variable in SQL code that prevents updates and deletes without a where
clause that includes the key columns defining the rows to change.
在 MySQL Workbench 中,Preferences -> 中有一个设置.SQL 编辑器 ->安全更新(无限制地拒绝更新和删除)
.我相信这在默认情况下甚至是启用的.
In MySQL Workbench there is a setting in Preferences -> SQL Editor -> Safe Updates (rejects UPDATEs and DELETEs with no restriction)
. I believe this is even on by default.
这篇关于除非指定了主键,否则防止从表中删除 *的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:除非指定了主键,否则防止从表中删除 *


基础教程推荐
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- 带更新的 sqlite CTE 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01