List:General Discussion« Previous MessageNext Message »
From:Steve Edberg Date:June 14 2002 7:15pm
Subject:RE: Is the order same?
View as plain text  
At 12:00 PM -0500 6/14/02, Jay Blanchard wrote:
>[snip]
>When I say 'select * from table', can I always be assured of the
>order in which the results are retrieved. If I issue the query a second
>time, (assuming no new insertions on the table), will I get the results in
>the same order, again?
>[/snip]
>
>Yes. Data is always sorted from first entered to last entered unless you
>change the sort with an ORDER BY or GROUP BY.


...unless you do any deletes and subsequent inserts, or you optimize 
the table, or MySQL decides to change internal record ordering, or...

As a general rule in relational databases, results should always be 
considered an unordered set unless you EXPLICITLY specify an ORDER BY.

	- steve


>HAGW!
>
>Jay
>sql, mysql, query
>


-- 
+------------------------------------------------------------------------+
| Steve Edberg                                      sbedberg@stripped |
| University of California, Davis                          (530)754-9127 |
| Programming/Database/SysAdmin               http://pgfsun.ucdavis.edu/ |
+------------------------------------------------------------------------+
| "If only life would imitate toys."                                     |
|                  - Ted Raimi, March 2002                               |
|                  - http://www.whoosh.org/issue67/friends67a.html#raimi |
+------------------------------------------------------------------------+
Thread
Is the order same?Vandana14 Jun
  • RE: Is the order same?Jay Blanchard14 Jun
    • RE: Is the order same?Steve Edberg14 Jun
      • RE: Is the order same?Francisco Reinaldo14 Jun
        • RE: Is the order same?William R. Mussatto15 Jun