在一个 Mysql 数据库中,每个表都基于启用了 Autocommit 的 InnoDB,带有子查询和/或连接的查询会是原子的吗?
例子:
INSERT INTO users SELECT (x,y,z) FROM users, comments WHERE users.id = comments.user_id;
(加入)UPDATE users, comments SET users.x = x1 WHERE users.age > 30;
(加入)UPDATE users, comments SET users.x = x1, comments.y = y1 WHERE users.age > 30;
(加入)UPDATE users, comments SET users.x = x1, comments.y = y1 WHERE users.id IN (SELECT id FROM users WHERE age > 30);
(子查询)