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

查看:21
本文介绍了如何选择没有 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.

使用行数有什么问题?

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

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