How to delete a range of records at once on MySQL?

前端 未结 4 441
野性不改
野性不改 2020-12-09 00:48

I have rows over 60000 in my table. How can I delete rows from 40000 to 50000 at once?

4条回答
  •  半阙折子戏
    2020-12-09 01:40

    Table: grocery

    id  item  
    ----------            
    1   rice
    2   soap
    3   rice
    4   rice
    

    DELETE FROM 'grocery' WHERE item="rice" LIMIT 2;

    This is easier than all the other ideas. for this particular item , there are 2 records can be deleted.

    And the answer is,

    2 rows deleted.

    SELECT * FROM grocery;

    id  item    
    ----------         
    1   rice
    2   soap
    

提交回复
热议问题