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

Teradata Vantage™ - SQL Data Manipulation Language

Advanced SQL Engine
Teradata Database
Release Number
Release Date
January 2021
Content Type
Programming Reference
Publication ID
English (United States)

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);