zhxjdwh
V2EX  ›  问与答

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

  •  
  •   zhxjdwh · Jul 26, 2021 · 1243 views
    This topic created in 1784 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   ·   4878 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 01:10 · PVG 09:10 · LAX 18:10 · JFK 21:10
    ♥ Do have faith in what you're doing.