DB2 Server for VSE & VM: Quick Reference


Queries


subselect

Specifies a result table derived from the tables or views identified in the FROM clause. Subselect is a component of the fullselect statement, the CREATE VIEW statement, the INSERT statement, and certain predicates.

>>-select_clause--from_clause----+---------------+-------------->
                                 '-where_clause--'
 
>-----+------------------+---+----------------+----------------><
      '-group_by_clause--'   '-having_clause--'
 

select-clause

Produces a final result table by selecting only the columns indicated by the select list from R, where R is the result of the previous operation. For example, if the group-by-clause and having-clause are not specified, R is the result of the where-clause.

             .-ALL------.
>>-SELECT----+----------+---+-*----------------------------+---><
             '-DISTINCT-'   |  .-,-----------------------. |
                            |  V                         | |
                            '----+-exp----------------+--+-'
                                 +-table_name.*-------+
                                 +-view_name.*--------+
                                 '-correlation_name.*-'
 

from-clause

Names a single table or view, or produces an intermediate result table. The intermediate result table contains all possible combinations of the rows of the named tables or views.

           .-,-----------------------------------------.
           V                                           |
>>-FROM--------+-table_name-+---+------------------+---+-------><
               '-view_name--'   '-correlation_name-'
 

where-clause

Produces an intermediate result table by applying search-condition to each row of R, where R is the result of the FROM clause. The result table contains the rows of R for which the search-condition is true.

>>-WHERE--search_condition-------------------------------------><
 

group-by-clause

Produces an intermediate result table by grouping the rows of R, where R is the result of the previous clause.

               .-,--------------.
               V                |
>>-GROUP BY-------column_name---+------------------------------><
 

having-clause

Produces an intermediate result table by applying search-condition to each group of R, where R is the result of the previous clause.

>>-HAVING--search_condition------------------------------------><
 

fullselect

Specifies a result table. If UNION is not used, the result of the fullselect is the result of the specified subselect.

>>-+-subselect----+--------------------------------------------->
   '-(fullselect)-'
 
      .------------------------------------------.
      V                                          |
>--------+------------------------------------+--+-------------><
         '--+-UNION-----+---+-subselect----+--'
            '-UNION ALL-'   '-(fullselect)-'
 

select-statement

Is the form of a query that can be specified or referenced in a DECLARE CURSOR statement and in the interactive select statement.

>>-fullselect----+--------------------+--+-------------+-------><
                 +-order_by_clause----+  '-with_clause-'
                 |               (1)  |
                 '-update_clause------'
 

Notes:

  1. The interactive select-statement does not incorporate the update-clause. That clause cannot be issued in ISQL or in the DBS Utility.

order-by-clause

Orders the rows of the result table by the values of the identified columns.

               .-,-----------------------------.
               V                     .-ASC--.  |
>>-ORDER BY--------+-column_name-+---+------+--+---------------><
                   '-integer-----'   '-DESC-'
 

update-clause

Refers to the cursor in a positioned UPDATE statement. The UPDATE statement can update only columns in the column-name list. This update-clause cannot be used interactively.

                    .-,--------------.
                    V                |
>>-FOR UPDATE OF-------column_name---+-------------------------><
 

with-clause

Specifies the isolation level at which the statement is executed.

>>-WITH----+-RR-+----------------------------------------------><
           +-CS-+
           '-UR-'
 


[ Top of Page | Previous Page | Next Page | Table of Contents ]