mysql delete under safe mode

前端 未结 4 2114
醉梦人生
醉梦人生 2020-12-12 12:41

I have a table instructor and I want to delete the records that have salary in a range An intuitive way is like this:

delete from instructor where salary be         


        
4条回答
  •  醉酒成梦
    2020-12-12 13:42

    You can trick MySQL into thinking you are actually specifying a primary key column. This allows you to "override" safe mode.

    Assuming you have a table with an auto-incrementing numeric primary key, you could do the following:

    DELETE FROM tbl WHERE id <> 0
    

提交回复
热议问题