Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ORDER_BY

LIMIT_TO

ASC

DESC

More Information

select expr

More Information

RDB/VMS SQL SELECT — VMS RDB_4.1_M

 select-statement =

 select-expr -+-------------------------> ----------+->;
   +----------+                                     |
   +> ORDER BY -++-> column-name -+-+---->----+-+-+ |
                |+-> integer -----+ +-> ASC --+ | | |
                |                   +-> DESC -+ | | |
                +---------------<---------------+ | |
    +---------------------- <---------------------+ |
    +-+---------------------> ----------------+-----+
      +> LIMIT TO ----> row-limit ---> ROWS --+


Additional information available:

ORDER_BYLIMIT_TOASCDESC

More Informationselect expr

More Information

 A SELECT statement specifies a result table.  A result table is
 derived from some combination of the tables or views identified
 in the FROM clause of the statement.

 The basic element of a SELECT statement is called a select
 expression.  See help on select expressions for more detail.
 The general form of a SELECT statement is a select expression
 with an optional ORDER BY clause.

 In interactive SQL you can issue a SELECT statement by itself or
 as part of a DECLARE CURSOR statement.  In programs, you can
 include SELECT statements in a DECLARE CURSOR statement (see the
 section on DECLARE CURSOR).  In addition, there is a special
 form of SELECT statement, called a singleton select, that is
 legal only in programs.  See the online help topic
 singleton_select for a description of singleton select
 statements.

select expr

 select-expr =

 -+-+-> select-clause -----+-+--------------------+-+
  | +->( select-expr ) ----+ +-> order-by-clause -+ |
  | +---------<------------+                        |
  | +->UNION -+-------+----+                        |
  |           +->ALL -+    |                        |
  +-------<----------------+                        |
  +-------------------------------------------------+
  +-+--------------------+--------------------------->
    +-> limit-to-clause -+

 See the top-level online help topic select_expr for a
 description of the select expression.

ORDER_BY

 Specifies the order of rows for the result table.  SQL sorts the
 rows from the intermediate result table by the values of columns
 specified in the ORDER BY clause.  You can refer to columns in
 the ORDER BY clause in two ways:

  o  By column name

  o  By column number, where the integer you specify indicates
     the left-to-right position of the column in the result table


 Select More_Information to continue.

Additional information available:

More Information

More Information

 You must use an integer to identify a column in the ORDER BY
 clause if that column in the select list is derived from a
 function or an arithmetic expression.  Whether you identify
 columns in an ORDER BY clause by name or number, they are called
 sort keys.

 When you use multiple sort keys, SQL treats the first column as
 the major sort key and successive keys as minor keys.  That is,
 it first sorts the rows into groups based on the first column
 name or value expression.  Then it uses the second to sort the
 rows within each group, and so on.  Unless you specify a sort
 key for every column in the result table, rows with identical
 values for the last sort key specified are in arbitrary order.

LIMIT_TO

 limit-to-clause =

 ---> LIMIT TO ----> row-limit ---> ROWS -->

 Specifies the number of rows in the result table.  The row limit
 is a numeric literal.

 If you specify both a select expression that can be updated and
 a LIMIT TO clause, the result table can be updated.

 When specifying a row limit, you cannot use a value expression
 that refers to a column specification that is a column of the
 select expression.

ASC

 Specifies that the values for sort keys are sorted in ascending
 order.

 If you do not specify ASCENDING or DESCENDING for the second or
 subsequent sort keys, SQL uses the order you specified for the
 preceding sort key.  If you do not specify the sorting order
 with the first sort key, the default order is ASCENDING.

DESC

 Specifies that the values for sort keys are sorted in descending
 order.

 If you do not specify ASCENDING or DESCENDING for the second or
 subsequent sort keys, SQL uses the order you specified for the
 preceding sort key.  If you do not specify the sorting order
 with the first sort key, the default order is ASCENDING.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026