# Change of order of rows in table

**URL:** <https://forums.percona.com/t/change-of-order-of-rows-in-table/220>\
**Category:** Other MySQL® Questions\
**Created:** [February 28, 2007, 1:23am UTC](https://forums.percona.com/t/change-of-order-of-rows-in-table/220 "2007-02-28T01:23:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![subhanshu4u](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@subhanshu4u](https://forums.percona.com/u/subhanshu4u)\
**Post date:** [February 28, 2007, 1:23am UTC](https://forums.percona.com/t/change-of-order-of-rows-in-table/220/1 "2007-02-28T01:23:55Z")

</div>

Hi,

I am using MySQL 5.1.15-beta

I have a table viz PLANTF.

Field | Type | Null | Key | Default | Extra |  
±-------------------±----------------------±-----±----± ------------------±------+  
| PLANID | smallint(5) unsigned | NO | PRI | 0 | |  
| PLANNAME | varchar(10) | NO | | | |  
| DESCRIPTION | mediumtext | YES | | NULL | |  
| INCREMENTAL | tinyint(3) unsigned | NO | | 0 | |  
| SUBSEQUENT | tinyint(3) unsigned | NO | | 0 | |  
| NRC | decimal(7,2) unsigned | NO | | 0.00 | |  
| PORTNRC | decimal(7,2) unsigned | NO | | 0.00 | |  
| MRC | decimal(7,2) unsigned | NO | | 0.00 | |  
| PORTMRC | decimal(7,2) unsigned | NO | | 0.00 | |  
| CONTRACTPERIOD | smallint(5) unsigned | NO | | 0 | |  
| EARLYCANCELCHARGES | decimal(7,2) unsigned | NO | | 0.00 | |  
| CREATED | timestamp | NO | | CURRENT\_TIMESTAMP | |  
| CREATEDBY | varchar(25) | NO | | | |  
| MODIFIED | datetime | NO | | | |  
| MODIFIEDBY | varchar(25) | NO | | | |  
±-------------------±----------------------±-----±----± ------------------±------+  
Now when the table was having ENGINE as INNODB the table looked as follows:

SELECT \* FROM PLANTF;

±-------±---------±-------------------±------------±— --------±-----±--------±------±--------±--------------- ±-------------------±--------------------±----------±— -----------------±-----------+  
| PLANID | PLANNAME | DESCRIPTION | INCREMENTAL | SUBSEQUENT | NRC | PORTNRC | MRC | PORTMRC | CONTRACTPERIOD | EARLYCANCELCHARGES | CREATED | CREATEDBY | MODIFIED | MODIFIEDBY |  
±-------±---------±-------------------±------------±— --------±-----±--------±------±--------±--------------- ±-------------------±--------------------±----------±— -----------------±-----------+  
| 0 | default | default plan | 6 | 6 | 0.00 | 0.00 | 0.00 | 0.00 | 0 | 0.00 | 2007-01-22 09:26:38 | | 0000-00-00 00:00:00 | |  
| 1 | tulip | 2 cents per minute | 30 | 6 | 0.00 | 0.00 | 10.00 | 0.00 | 0 | 0.00 | 2007-01-22 09:26:38 | | 0000-00-00 00:00:00 | |  
| 2 | alfa | 5 cents per minute | 30 | 6 | 0.00 | 0.00 | 10.00 | 0.00 | 0 | 0.00 | 2007-01-22 09:26:38 | | 0000-00-00 00:00:00 | |  
| 3 | aims | 7 cents per minute | 30 | 6 | 0.00 | 0.00 | 60.00 | 0.00 | 0 | 0.00 | 2007-01-22 09:26:38 | | 0000-00-00 00:00:00 | |

Now when i changed the engine to NDB the table looked like follows:

SELECT \* FROM PLANTF

±-------±---------±-------------------±------------±— --------±-----±--------±------±--------±--------------- ±-------------------±--------------------±----------±— -----------------±-----------+  
| PLANID | PLANNAME | DESCRIPTION | INCREMENTAL | SUBSEQUENT | NRC | PORTNRC | MRC | PORTMRC | CONTRACTPERIOD | EARLYCANCELCHARGES | CREATED | CREATEDBY | MODIFIED | MODIFIEDBY |  
±-------±---------±-------------------±------------±— --------±-----±--------±------±--------±--------------- ±-------------------±--------------------±----------±— -----------------±-----------+  
| 1 | tulip | 2 cents per minute | 30 | 6 | 0.00 | 0.00 | 10.00 | 0.00 | 0 | 0.00 | 2007-01-22 09:26:38 | | 0000-00-00 00:00:00 | |  
| 2 | alfa | 5 cents per minute | 30 | 6 | 0.00 | 0.00 | 10.00 | 0.00 | 0 | 0.00 | 2007-01-22 09:26:38 | | 0000-00-00 00:00:00 | |  
| 0 | default | default plan | 6 | 6 | 0.00 | 0.00 | 0.00 | 0.00 | 0 | 0.00 | 2007-01-22 09:26:38 | | 0000-00-00 00:00:00 | |  
| 3 | aims | 7 cents per minute | 30 | 6 | 0.00 | 0.00 | 60.00 | 0.00 | 0 | 0.00 | 2007-01-22 09:26:38 | | 0000-00-00 00:00:00 | |  
±-------±---------±-------------------±------------±— --------±-----±--------±------±--------±--------------- ±-------------------±--------------------±----------±— -----------------±-----------+

Any reasons plz why the order changed with same query.

Also i want to let u know that the same happened with other tables in my database which are having a column with primary key.

Plz help  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![Peter](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/peter/32/2_2.png) [@Peter](https://forums.percona.com/u/Peter)\
**Post date:** [February 28, 2007, 5:15am UTC](https://forums.percona.com/t/change-of-order-of-rows-in-table/220/2 "2007-02-28T05:15:20Z")

</div>

Never relay on order of rows in the table - it is generally undefined unless you use ORDER BY in your Select
