Hi.

I guess your "problem" comes from the fact that SQL has no concept of
internal order. If you do not specify an ORDER BY clause, the order or
records returned is undefined, i.e. random.

Of course, MySQL has some kind of internal order depending on many
factors, but you may not rely on it. And neither you may rely on the
fact that a PRIMARY KEY influences the internal order. You have to use
an ORDER BY clause if you want to get a sorted result (of course, you
want a key to speed up the ORDER BY clause).

As said, the (sorting) behaviour without ORDER BY is undefined
according to the specification and may change without notice.

Bye,

        Benjamin.

On Mon, Mar 04, 2002 at 09:56:53PM -0700, [EMAIL PROTECTED] wrote:
> Greetings!
> 
> If you do not have an index on any column in a table, how does mysql
> handle repeated queries (i.e. SELECT * FROM report;)
> 
> I am noticing that if I run the following three queries, I get different
> results for the third query:
> 
> SELECT * FROM report;
> SELECT * FROM report ORDER BY lastname;
> SELECT * FROM report;
> 
[...]
> p.s. This is for my understanding.  I solved my actual problem by simply
> placing a primary key on the appropriate columns - as I should have from
> the beginning! <G>).
[...]

-- 
[EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to