Subqueries
SELECT ProdID, Price, Qty
FROM Product
WHERE SupID IN
(SELECT SupplierID
FROM Supplier
WHERE City = ‘London’)
Subquery is always evaluated before the main query.
SELECT ProdID
FROM Product
WHERE Qty >
(SELECT Avg(Qty)
FROM Product
WHERE SupID IN (‘1’, ‘2’))
Previous slide
Next slide
Back to first slide
View graphic version