PhpMyadmin CSV 导入数据顺序?我的 CSV 订单混乱了?

发布于 2024-09-26 19:44:18 字数 112 浏览 1 评论 0原文

我正在尝试按照 CSV 文件中的顺序将 CSV 数据文件导入回数据库。但是,当我导入时,订单与文件中的显示方式完全不同。

有没有办法强制 PHPmyadmin 以与 CSV 完全相同的顺序导入?

I'm trying to import my CSV data file back into my database in the same order it is in the CSv file. However when I import the order is all jumbled from how it appears in the file.

Is there a way to force PHPmyadmin to import in the exact same order as the CSV?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冰雪梦之恋 2024-10-03 19:44:18

默认情况下,SQL 数据库没有顺序。如果您想要排序,请提供要排序的列,然后在查询中的 ORDER BY 中使用此列。

对于您的情况,您可以考虑创建自动增量主键。该密钥将随着您的导入而增加,然后适合您的要求。

SQL databases don't have an order by default. If you want ordering, provide a column to sort on, then use this column in ORDER BY in your queries.

For your situation, you could look at making an autoincrement primary key. This key will increment with your import and then be suitable for your requirements.

桃气十足 2024-10-03 19:44:18

我认为它确实以相同的顺序导入。但 MySQL 有时会做一些愚蠢的事情。

在 PHPMyAdmin 中,单击您的表。然后单击“操作”选项卡。您将看到“更改表顺序”选项。

选择您想要排序的字段和方向,然后单击执行。

瞧。

I think it does import in the same order. But MySQL sometimes does silly things.

In PHPMyAdmin, click on your table. Then click on the "Operations" tab. You will see an option for "Alter table order by".

Select the field you want to order by and the direction and click Go.

voila.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文