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

Database Design

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
kko1591750222108.ditamap
dita:ditavalPath
kko1591750222108.ditaval
dita:id
B035-1094
lifecycle
previous
Product Category
Teradata Vantage™

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;