* Albert
> Stefan,

I'm Roger, but I reply anyway. :)

> Do you imply that tables cannot be sorted desc or asc based on one of the
> columns e.g. a last name? or am I misunderstanding you.

In relational database theory the order of rows within the table is
undefined, i.e. it is up to the server, and the server can re-organize a
table at any time. If you want an ordered result, you have to use ORDER BY
in your SELECT statement.

However, the MySQL server has some features that can be used to achieve
exactly what you ask. It is possible to sort a table physically, in order to
do faster reads later. The order is however destroyed if you do additional
inserts. See the ORDER BY option of the ALTER TABLE statement:

"ORDER BY allows you to create the new table with the rows in a specific
order. Note that the table will not remain in this order after inserts and
deletes. In some cases, it may make sorting easier for MySQL if the table is
in order by the column that you wish to order it by later. This option is
mainly useful when you know that you are mostly going to query the rows in a
certain order; by using this option after big changes to the table, you may
be able to get higher performance."

<URL: http://www.mysql.com/doc/en/ALTER_TABLE.html >

--
Roger


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to