zhxjdwh
V2EX  ›  问与答

update 能保证并发情况下的 数据一致性吗?

  •  
  •   zhxjdwh · Jul 26, 2021 · 1262 views
    This topic created in 1792 days ago, the information mentioned may be changed or developed.
    请教一下各位大佬,
    这条 sql,并发情况下 能保证 money 永远不为负数吗?
    update account set money=money-100 where id=1 and money>100
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1174 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 17:42 · PVG 01:42 · LAX 10:42 · JFK 13:42
    ♥ Do have faith in what you're doing.