How to SELECT the last 10 rows of an SQL table which has no ID field?(如何选择没有 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 行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何选择没有 ID 字段的 SQL 表的最后 10 行?


- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- SQL 临时表问题 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01