MySQL 事务回滚。在执行删除、更新等操作时,防止误操作
SELECT * FROM TABLE_NAME I WHERE I.TRANS_NO='P-2019000025'; # 原始数据 START TRANSACTION; SELECT COUNT(1) FROM TABLE_NAME I; #10条 DELETE FROM TABLE_NAME WHERE TRANS_NO='P-2019000025'; SELECT COUNT(1) FROM TABLE_NAME I; #删除后还有9条 ROLLBACK; SELECT * FROM TABLE_NAME I WHERE I.TRANS_NO='P-2019000025'; # 原始数据没变
确保DELETE SQL 没问题后,再拿出来单独执行