Null Predicate; Considerations For Null - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

-------
186
--- 1 row(s) selected.
Find those items (and their suppliers) in PARTS that have a supplier in the PARTSUPP table:
SELECT P.partnum, P.partdesc, S.suppnum, S.suppname
FROM sales.parts P,
invent.supplier S
WHERE P.partnum, S.suppnum IN
(SELECT partnum, suppnum
FROM invent.partsupp);
Find those employees in EMPLOYEE whose last name and job code match the list of last
names and job codes:
SELECT empnum, last_name, first_name
FROM persnl.employee
WHERE (last_name, jobcode) IN
(VALUES ('CLARK', 500), ('GREEN', 200));

NULL Predicate

The NULL predicate determines whether all the expressions in a sequence are null. See
(page
230).
row-value-constructor IS [NOT] NULL
row-value-constructor is:
(expression [,expression]...)
| row-subquery
row-value-constructor
specifies the operand of the NULL predicate. The operand can be either of these:
(expression [,expression ]...)
is a sequence of SQL value expressions, separated by commas and enclosed in parentheses.
expression cannot include an aggregate function unless expression is in a HAVING
clause. expression can be a scalar subquery (a subquery that returns a single row
consisting of a single column). See
row-subquery
is a subquery that returns a single row (consisting of a sequence of values). See
(page
If all of the expressions in the row-value-constructor are null, the IS NULL predicate is
true. Otherwise, it is false. If none of the expressions in the row-value-constructor are null,
the IS NOT NULL predicate is true. Otherwise, it is false.

Considerations for NULL

Summary of NULL Results
Let rvc be the value of the row-value-constructor. This table summarizes the results of
NULL predicates. The degree of a rvc is the number of values in the rvc.
Expressions
degree 1: null
degree 1: not null
degree>1: all null
degree>1: some null
degree>1: none null
------------------
186 MegaByte Disk
250).
rvc IS NULL
TRUE
FALSE
TRUE
FALSE
FALSE
"Expressions" (page
rvc IS NOT NULL
NOT rvcIS NULL
FALSE
FALSE
TRUE
TRUE
FALSE
FALSE
FALSE
TRUE
TRUE
TRUE
208).
"Subquery"
NOT rvc IS NOT
NULL
TRUE
FALSE
TRUE
TRUE
FALSE
Predicates
"Null"
241

Advertisement

Table of Contents
loading

Table of Contents