Hi Friend,
Today I was testing the command 'Load data infile ...' command (
http://dev.mysql.com/doc/refman/5.0/en/loading-tables.html ) in my system.
That time I was surprised when I put select statement in that table. The
scenario as follows :

In a text file which is to be loaded, I am having data as follows:
3       v,4  a

mysql> desc mytable;
+-------+---------+------+-----+---------+----------------+
| Field | Type    | Null | Key | Default | Extra          |
+-------+---------+------+-----+---------+----------------+
| id    | int(11) |      | PRI | NULL    | auto_increment |
| foo   | char(1) | YES  |     | NULL    |                |
+-------+---------+------+-----+---------+----------------+
2 rows in set (0.00 sec)

mysql> select * from mytable;
+----+------+
| id | foo  |
+----+------+
|  1 | a    |
|  2 | b    |
+----+------+
2 rows in set (0.01 sec)

mysql> load data infile '/home/mysql/egdata' into table mytable lines
terminated by ',';
Query OK, 2 rows affected, 0 warnings (0.00 sec)
Records: 2  Deleted: 0  Skipped: 0  Warnings: 0

mysql> select * from mytable;
+----+------+
| id | foo  |
+----+------+
|  1 | a    |
|  2 | b    |
|  3 | v    |
|  4 | a    |
+----+------+
4 rows in set (0.00 sec)

 mysql> delete from mytable where id in (3,4);
Query OK, 2 rows affected (0.00 sec)

mysql> load data infile '/home/mysql/egdata' into table mytable lines
terminated by ',';
Query OK, 2 rows affected, 0 warnings (0.00 sec)
Records: 2  Deleted: 0  Skipped: 0  Warnings: 0

mysql> select * from mytable;
+----+------+
| id | foo  |
+----+------+
|  1 | a    |
|  2 | b    |
|  4 | a    |
|  3 | v    |
+----+------+
4 rows in set (0.00 sec)

The select query gives the different orders for value '3' and '4' which was
loaded twice with same txt file. Why is this happening like this? Any reason
or algorithm involve in this?

Reply via email to