INTERSECT Example | SQL Statements | Teradata Vantage - 17.05 - Example - 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)

Assume that two tables contain the following rows:

SPart table   SLocation table
SuppNo PartNo   SuppNo SuppLoc
100 P2   100 London
101 P1   101 London
102 P1   102 Toronto
103 P2   103 Tokyo

To then select supplier number (SuppNo) for suppliers located in London (SuppLoc) who supply part number P1 (PartNo), use the following request:

   SELECT SuppNo FROM SLocation 
   WHERE SuppLoc = 'London' 
   SELECT SuppNo FROM SPart 
   WHERE PartNo = 'P1';

The result of this request is: