SQL/MX Quick Start (G06.24+, H06.03+)

Selecting Information From a Table
HP NonStop SQL/MX Quick Start523724-002
2-4
Displaying Descriptions of Columns
Example
Using the data in the ODETAIL table, calculate the total price for the number of units of
each part in an order. Select parts from order number 100210:
SELECT ORDERNUM, PARTNUM, QTY_ORDERED*UNIT_PRICE
FROM ODETAIL
WHERE ORDERNUM = 100210;
The selected rows are:
Order/Num Part/Num (EXPR)
---------- -------- ---------------------
100210 244 10500.00
100210 2001 3300.00
100210 2403 3720.00
100210 5100 1500.00
--- 4 row(s) selected.
Tip
If an item in the select list is an expression, the heading of the column is (EXPR).
You can customize the name of the column in the select list by using the AS
clause:
QTY_ORDERED * UNIT_PRICE AS TOTAL_PRICE
If you use this AS clause, TOTAL_PRICE is the heading for the calculated value
instead of (EXPR).
You can use these arithmetic operators in expressions:
You can use parentheses to clarify the meaning of an expression:
QTY_ORDERED * (UNIT_PRICE + 1.5)
You can also use an expression as part of a condition in a WHERE clause:
WHERE (QTY_ORDERED * UNIT_PRICE) < 2000
Displaying Descriptions of Columns
To determine the names of the columns in a table, the types of data, and the maximum
number of characters allowed, use the INVOKE command. The INVOKE command
displays the definition of the columns.
+ Addition
Subtraction
* Multiplication
/ Division
** Exponentiation