How to SELECT the last 10 rows of an SQL table whi

2020-02-09 07:22发布

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, since there is no ID column, I can't say:

SELECT * FROM big_table ORDER BY id DESC

What SQL statement would show me the last 10 rows of this table?

The structure of the table is simply this:

columns are: A, B, C, D, ..., AA, AB, AC, ... (like Excel)
all fields are of type TEXT

13条回答
做个烂人
2楼-- · 2020-02-09 07:51

You can use the "ORDER BY DESC" option, then put it back in the original order:

(SELECT * FROM tablename ORDER BY id DESC LIMIT 10) ORDER BY id;

查看更多
登录 后发表回答