SQL/MX Quick Start (G06.24+, H06.03+)
Selecting Information From a Table
HP NonStop SQL/MX Quick Start—523724-002
2-3
Displaying Calculated Values
6603 PRINTER CONTROLLER 430
--- 2 row(s) selected.Example
Display the parts where part description is ”PRINTER CONTROLLER”:
SELECT PARTNUM, QTY_AVAILABLE FROM PARTS
WHERE PARTDESC = 'PRINTER CONTROLLER';
The selected row is:
Part/Num Qty/Avail
-------- -----------
6603 430
--- 1 row(s) selected.
Tip
•
To continue a long statement or command on the next line, press Enter. MXCI
displays a continuation prompt (+>), and you can continue your statement. To end
the statement, use the semicolon:
>>SELECT PARTNUM, PARTDESC, QTY_AVAILABLE FROM PARTS
+>WHERE QTY_AVAILABLE < 500;
•
If a column contains text (character data), enclose its value in single quotes and
enter the value to match the value that is stored. You can omit spaces at the end of
a value.
•
Remember that OSS is case-sensitive. If you are not sure whether a value in the
table appears in uppercase or lowercase letters, use the UPSHIFT function to
convert lowercase letters in the part description to uppercase before making the
comparison:
SELECT PARTNUM, QTY_AVAILABLE FROM PARTS
WHERE UPSHIFT (PARTDESC) = 'PRINTER CONTROLLER';
•
You can specify any column of the FROM table in the WHERE condition. The
column does not have to be in the select list. For example, you can display only
PARTNUM but use PARTDESC in the condition that selects rows
Displaying Calculated Values
You can calculate values to be displayed by including arithmetic expressions that
operate on values from individual rows. You can perform arithmetic on any type of
numeric value but not on character values.