In the last episode (Jan 26), Don said:
> I have a table called Ports that contains Port information and has
> several columns. I've designated the Portname column as Primary as
> it is unique (I did not specify it as unique). When I do a:
> SELECT * FROM Ports;
> It does NOT show the table contents in index order (Portname
> beginning with "A" all the way through "Z") but rather in the order
> they were entered.
SQL tries to give you your results as fast as possible. Indexes are
used when they can help. They cause more disk I/O though, so if MySQL
determines that a query will read more than 10% (I think) of the
records in a table, it simply drops to a full table scan.
> So, it seems to me that indexes are only used for querying. If I run
> through the data or issue the above SELECT statement, how do I
> display my rows in Primary Key order?
SELECT * FROM Ports ORDER BY Portname;