Subquery Examples | SQL SELECT Statements | Teradata Vantage - Example: Simple Subquery Using the IN Logical Predicate - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

This example selects the names and department locations of those employees who report to manager Aguilar (whose employee number is 10007).

     SELECT name, loc
     FROM employee, department
     WHERE employee.dept_no = department.dept_no
     AND   employee.dept_no IN (SELECT dept_no
                                FROM department
                                WHERE mgr_no = 10007);