HI
I have a simple table in my database called ‘avatars’
CREATE TABLE `avatars` (
`avatar_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`avatar_image_name` VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (`avatar_id`)
) ENGINE=MYISAM AUTO_INCREMENT=60 DEFAULT CHARSET=latin1
Which has some data in it.
When I run a simple select query:
SELECT *
FROM `avatars`
LIMIT 0 , 30
What order does it follow to show the resultset? As u can see from the attached screenshot that the autoincrement id column is not in serial order.
Please explain this.
r937
2
it’s really simple
without an ORDER BY clause, the database engine is allowed to return rows in whatever sequence it wishes
I know but what I want to know is that does it have any internal logic at all?
r937
4
it returns them in the sequence it finds them
But logically should not it find the records in the sequence it was inserted?
Thanks.
r937
6
no, because the insertion takes place on the most readily available disc space, which could be anywhere in the sequence
Thats strage!!
Where did you find this info sir? coz I was unble to see any such info in the official document
r937
8
you’re gonna have an even harder time finding anything that contradicts it