简体   繁体   中英

PhpMyadmin CSV Import data order? Mine is jubmled from CSV order?

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM