简体   繁体   中英

Phpmyadmin Import Data

I have a Mysql table that looks like this:

+-------+
| NAME  |
+-------+
| James |
| Alex  |
| Jones |
| ...   |
+-------+

Each name is unique.

And I have a txt file that is a list of names that needs to be imported into this table.

The list needs to be imported keeping the order of the names, but when I use Phpmyadmin to import it, the list seems to get sorted by name prior to being imported.

How can I prevent this behavior? I just need it to be imported as is, without any change. And when I query it should return the results at the same order I inserted them.

在导入之前给每个记录一个ID,然后您可以按ID排序以获得原始布局

by default the data being returned from mysql are ordered prior to an indexed column (phpmyadmin has nothing to do with the ordering) if you define an index on the table using the name column the table results will be sorted according to the index of this column but if you want to order them prior to the last insert you have, order them by ID only if you set the ID as an auto_increment column in the design cuase it will automatically increment the values by 1 for the newly inserted rows. :)

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