排他写锁

如果a为1根本不存在加了什么锁?

只根据主键进行查询,没有查询到数据,不产生锁。

1 begin; 2 select * from goods where id = 1 for update; 3 commit;

https://www.cnblogs.com/jiuhaoyun/p/8990265.html

看到select * from t where id = 1 for update,能想到什么