tags:

views:

14

answers:

2

I am using phpadmin and I exported a .sql file to backup my database. When I went to import the .sql file it imports the rows in the wrong order. Is their anyway to remedy this problem?

+3  A: 

By default there is no order in the rows of a table. If you want any order you should always be using a order by. The result of select on the same table with order by will always be the same before backup and after the restore.

codaddict
This is very true. I have not worked very long with mysql and databases so I did not realize I could do it that way. I need to do that.
qw3n
+2  A: 

And how do you know they're in the wrong order? Do you mean that when you do a

select * from foo

for example, you're not seeing the records in the same order as before? That behavior is normal. If you don't specify an ORDER BY clause, the order is unspecified....

ראובן
How would you specify an order for an import then? Also, using php admin I can look at the mysql tables and after the import I realized that my auto increment field was all out of order.
qw3n