Q:

delete the last row in a table using sql query?

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 the localhost. The query I tried for this is as follows:
DELETE MAX(`id`) FROM `marks`;

There are 8 columns in the table. I want to delete the last column without specifyingDELETE FROM marks where id=8; After deleting the 8th record, i want to delete the 7th after that 6th and so on upto 1st record without specifying manually.
Please help me in this issue with example coding. Thanks in advance.

A:

If id is auto-increment then you can use the following 
delete from marks
order by id desc limit 1

A:

@Abhshek's Answer is right and works for you but you can also try the following code if the id is not increment
DELETE FROM MARKS WHERE ID=(SELECT MAX(id) FROM MARKS)

