Get the id of a row when UNIQUE KEY is violated

前端 未结 2 570
遇见更好的自我
遇见更好的自我 2021-01-25 04:35

I have a table user. It has columns id and email.

USER TABLE

id | email
1  | xxx@gmail.com
2  | yyy@gmail.com
         


        
2条回答
  •  走了就别回头了
    2021-01-25 05:18

    In scaning by UNIQUE KEY BTREE is used so it's quite fast.

    Don't you want check for existing of value by yourself in additional select query

提交回复
热议问题