Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Usage » Queries: Selecting Data from a Table

Matching rows by sound Next Page

The ORDER BY clause: ordering results


Unless otherwise requested, the database server returns the rows of a table in an order that has no meaning. Often it is useful to look at the rows in a table in a more meaningful sequence. For example, you might like to see products in alphabetical order.

You order the rows in a result set by adding an ORDER BY clause to the end of the SELECT statement. This SELECT statement has the following syntax:

SELECT column-name-1, column-name-2,...
FROM table-name
ORDER BY order-by-column-name

You must replace column-name-1, column-name-2, and table-name with the names of the desired columns and table you are querying, and order-by-column-name with a column in the table. As before, you can use the asterisk as a short form for all the columns in the table.

List the products in alphabetical order