Searching for Nulls and Nonnulls In the Same Search Condition - Teradata Database

Teradata Database Design

Product
Teradata Database
Release Number
15.10
Language
English (United States)
Last Update
2018-10-06
Product Category
Software

Searching for Nulls and Nonnulls In the Same Search Condition

To search for nulls and non‑nulls within the same predicate, the search condition for nulls must be specified separately from any other search conditions.

For example, to select the names of all employees with the job title of ‘Vice Pres,’ ‘Manager,’ or null, you could type the following SELECT statement:

     SELECT name, job_title 
     FROM employee 
     WHERE job_title IN (’Manager’ OR ’Vice Pres’) 
     OR    job_title IS NULL;