SQL/MP Query Guide
Retrieving Data: How to Write Queries
HP NonStop SQL/MP Query Guide—524488-003
1-31
Comparison Predicate
Comparison Predicate
You can use this comparison operators to compare the value of one expression with
the value of another expression:
<> < <= = >= >
The data types of the two expressions must be compatible for the comparison to take
place. For example, an expression of data type CHAR cannot be compared with
another expression of data type NUMERIC.
This SELECT statement illustrates the use of the >= comparison operator:
SELECT LAST_NAME, FIRST_NAME, SALARY
FROM EMPLOYEE
WHERE SALARY >= 50000 ;
The query returns this result:
LAST_NAME FIRST_NAME SALARY
--------- ---------- --------
Simpson Travis 68000.00
Nakagawa Etsuro 72000.00
Nakamura Eichiro 50000.00
Example 1-8. Sample Tables for Predicate Examples
EMPLOYEE Table
EMP_ID LAST_NAME FIRST_NAME DEPT_NUM MGR_ID SALARY
------ --------- ---------- -------- ------ --------
2703 Smith James 7620 2705 47500.00
2705 Simpson Travis 7600 6554 68000.00
2906 Nakagawa Etsuro 6400 6554 72000.00
3598 Nakamura Eichiro 6480 2906 50000.00
4096 Murakami Kazuo 6410 3598 36000.00
5361 Smythe Roger 7690 9069 42650.00
9069 Smith John 7690 2705 38760.00
9502 Smithson Richard 6400 6554 58300.00
DEPT Table
DEPT_NUM DEPT_NAME DEPT_LOC
-------- ------------------------ --------
6400 Marketing - Far East 900
6410 Marketing - Korea 910
6420 Marketing - Hong Kong 920
6440 Marketing - Singapore 940
6470 Marketing - Taiwan 970
6480 Marketing - Australia 980
7600 Marketing - USA 100
7620 Marketing - USA West 120
7690 Marketing - USA East 200