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