I wish SQL had a dry-run mode in updates and deletes for that reason.
"Run it as a query first" gets 90% of the way until you drop a constraint by accident whilst rewriting it as an update :o
"Run it as a query first" gets 90% of the way until you drop a constraint by accident whilst rewriting it as an update :o
If it is Postgres (don't know about other dbs), you can go a way long way using "savepoints" and "rollbacks" to truly have a trial-and-error safe surgery on db. Still dangerous, but quite helpful. I hate working on any other db without those features. Postgres also allows schema changes to be within a txn envelope.
You can jam a select in the end of the transaction to check what happens.
https://dev.mysql.com/doc/refman/8.0/en/mysql-command-option...