如何选择没有 ID 字段的 SQL 表的最后 10 行?

2022-01-05 00:00:00 sql mysql phpmyadmin

我有一个包含 25000 行的 MySQL 表.

I have an MySQL table with 25000 rows.

这是一个导入的 CSV 文件,所以我想查看最后十行以确保它导入了所有内容.

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

但是,因为没有ID栏,所以不能说:

However, since there is no ID column, I can't say:

SELECT * FROM big_table ORDER BY id DESC

哪个 SQL 语句会显示该表的最后 10 行?

表格的结构很简单:

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

推荐答案

SQL 表没有隐式排序,排序必须来自数据.也许您应该向表中添加一个字段(例如一个 int 计数器)并重新导入数据.

SQL tables have no implicit ordering, the order has to come from the data. Perhaps you should add a field to your table (e.g. an int counter) and re-import the data.

然而,这只会给出导入的顺序,而不是数据.如果您的数据没有排序,您必须了解如何添加它.

However that will only give the order of the import and not the data. If your data has no ordering you have to find out how to add it.

你说

...以确保它导入了所有内容.

...to make sure it imported everything.

使用行数有什么问题?

相关文章