Databases Reference
In-Depth Information
If we enter a big number in the
Show...rows
dialog, the
same results will be achieved (and we may face the same
potential problems).
Sorting Results
In SQL, we can never be sure of the order in which the data is retrieved, unless we
explicitly sort the data. Some implementations of the retrieving engine may show
results in the same order as when data was entered, or by primary key, but a sure
way to get results in the order we want is by sorting them explicitly.
One obvious way to sort is by key. The
Sort
dialog shows all the keys already
defined. Here we see a key named
PRIMARY
, the name given to our primary key on
the
isbn
field when we checked
Primary
for this field at creation time:
This might be the only way to sort on multiple fields at once (for multi-fields indexes).
If we choose to sort by
author_id (Descending)
, we see:
We now see a small red triangle pointing downwards beside the
author_id
header.
This means that the current sort order is 'descending'. Moving the mouse cursor over
the
author_id
header makes the red triangle change direction, to indicate what will
happen if we click on the header: a sort by ascending
author_id
.
In fact, all the column headers can be clicked to sort on this column, even if they are
not part of an index. We can confirm this by watching the SQL query at top of screen;
it should contain an
ORDER BY
clause.
Search WWH ::
Custom Search