INTERSECT Example | SQL Statements | Teradata Vantage - Example: INTERSECT - Analytics Database - Teradata Vantage

SQL Data Manipulation Language

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
pon1628111750298.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
esx1472246586715
lifecycle
latest
Product Category
Teradata Vantageā„¢

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' 
   INTERSECT 
   SELECT SuppNo FROM SPart 
   WHERE PartNo = 'P1';

The result of this request is:

   SuppNo
   ------
      101