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.
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. 🙂