How to SELECT the last 10 rows of an SQL table which has no ID field?

后端 未结 13 1449
灰色年华
灰色年华 2020-12-15 17:38

I have an MySQL table with 25000 rows.

This is an imported CSV file so I want to look at the last ten rows to make sure it imported everything.

However, sinc

13条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-15 18:13

    If you want to retrieve last 10 records from sql use LIMIT. Suppose the data base contains 20 records.Use the below query

    SELECT * FROM TABLE_NAME LIMIT 10,20;
    

    where 10,20 is the offset value.Where 10 represent starting limit and 20 is the ending limit.

    i.e 20 -10=10 records

提交回复
热议问题