Subqueries
SELECT Purchase.product
FROM Purchase
WHERE buyer =
(SELECT name
FROM Person
WHERE social-security-number = ‘123 - 45 - 6789’);
In this case, the subquery returns one value.
If it returns more, it’s a run-time error.
Previous slide
Next slide
Back to first slide
View graphic version