如何选择没有ID字段的SQL表的最后10行? [英] How to SELECT the last 10 rows of an SQL table which has no ID field?

查看:133
本文介绍了如何选择没有ID字段的SQL表的最后10行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有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.

使用行计数有什么问题?

What's wrong with using row count?

这篇关于如何选择没有ID字段的SQL表的最后10行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆