sardina
V2EX  ›  问与答

推荐一个有趣 [搞笑] 的直播 [MySQL vs. PostgreSQL,谁是世界第一?]

  •  
  •   sardina · Aug 13, 2023 · 1192 views
    This topic created in 1011 days ago, the information mentioned may be changed or developed.

    直播回放好像只在微信视频号搜到

    里面有个问题,在 mysql 执行下列 sql

    mysql> create table test1 (id int primary key,name char);
    Query OK, 0 rows affected (0.06 sec)
    
    mysql> begin;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> insert into test1(id,name)VALUES(1,"l");
    Query OK, 1 row affected (0.00 sec)
    
    mysql> insert into test1(id,name)VALUES(1,"2");
    ERROR 1062 (23000): Duplicate entry '1' for key 'test1.PRIMARY'
    mysql> commit;
    Query OK, 0 rows affected (0.01 sec)
    
    mysql> select * from test1;
    +----+------+
    | id | name |
    +----+------+
    |  1 | l    |
    +----+------+
    1 row in set (0.00 sec)
    

    执行 commit 后,第一条 sql 是会执行,执行 rollback 后才会都取消执行

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1047 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 22:34 · PVG 06:34 · LAX 15:34 · JFK 18:34
    ♥ Do have faith in what you're doing.