SQL/MX Quick Start (G06.24+, H06.03+)
Stating Conditions for Selecting Data
HP NonStop SQL/MX Quick Start—523724-002
3-4
Specifying What Not to Select
The selected rows are:
PARTNUM PARTDESC PRICE
------- ------------------ ------------
2001 GRAPHIC PRINTER,M1 1100.00
2002 GRAPHIC PRINTER,M2 1500.00
2003 GRAPHIC PRINTER,M3 2000.00
3103 LASER PRINTER, X1 4200.00
--- 4 row(s) selected.
Tip
You can combine any number of conditions with AND and OR to express conditions.
The sequence of evaluation is AND before OR unless you specify otherwise by using
parentheses. To ensure a row is first compared to two conditions connected by OR,
you must enclose the OR conditions in parentheses.
Specifying What Not to Select
Sometimes it is easier to specify what information you do not want.
Example
Display quantity available of all parts except parts numbered between 3000 and 5999:
SELECT PARTNUM, QTY_AVAILABLE
FROM PARTS
WHERE PARTNUM NOT BETWEEN 3000 AND 5999;
Some of the selected rows are:
PARTNUM QTY_AVAILABLE
------- -------------
186 186
212 3525
244 4426
... ...
2405 2712
6201 2306
... ...
7301 2332
--- 18 row(s) selected.
Tip
•
If you want NOT to apply to an entire search condition, you must enclose the
condition in parentheses:
WHERE NOT(PARTNUM BETWEEN 3000 AND 5999 OR PARTNUM = 2001)