delete the last row in a table using sql query?

前端 未结 4 1744
[愿得一人]
[愿得一人] 2021-01-02 02:43

I am trying to delete the last record in the table named \"marks\" in the database using MySql query. I was tried to do so. Also I tried on

4条回答
  •  不知归路
    2021-01-02 02:57

    This is not the best but a different solution.

    DELETE FROM marks 
    WHERE  id = (SELECT id 
                 FROM   marks 
                 ORDER  BY id DESC 
                 LIMIT  1); 
    

提交回复
热议问题