SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
E-21
Expressions
These examples shows three different ways to request an EXPLAIN report for a
query that uses multiple lines in SQLCI:
Example 1.
>>EXPLAIN SELECT U1,U2, MIN(U3), MAX(U3)
+>FROM \SYS.$VOL.CAT.T
+>GROUP BY 1 , 2;
Example 2.
>>EXPLAIN " SELECT U1,U2, MIN(U3), MAX(U3) "
+>&" FROM \SYS.$VOL.CAT.T "
+>&" GROUP BY 1 , 2";
Example 3.
>>PREPARE SAVQ FROM SELECT U1,U2, MIN(U3), MAX(U3)
+>FROM \SYS.$VOL.CAT.T
+>GROUP BY 1 , 2;
..
--- SQL command prepared.
>> EXPLAIN SAVQ;
For examples of EXPLAIN reports, see the SQL/MP Query Guide. For an example
of a DEFINE report (an optional portion of an EXPLAIN report that describes the
DEFINEs used in SQL statements within a program), see the SQL/MP
programming manual for your host language.
Expressions
An expression specifies a value. An expression can be a simple character string, a
numeric literal, a column name, or a condition (CASE expression) that specifies the
value of the column in a row of a table. An expression can also include function calls
and arithmetic operators. All these are simple expressions:
An expression can have a character, numeric, date-time, or INTERVAL data type. The
data type of an expression is the data type of the value of the expression.
The remainder of this entry discusses numeric, date-time, and INTERVAL expressions.
For more information about character expressions, see Character Expressions on
page C-14. For more information about conditional expressions, see CASE Expression
on page C-2.
“ABILENE” A character string
-57 A numeric literal
CUSTNAME The value in column CUSTNAME
COUNT (DISTINCT
CITY)
The COUNT function applied to the values in column
CITY