Chapter 5 Exercise 11

11. What is the amount of money customers spent on cat products after they adopted a cat?

First get customers who adopted cats. Use Min to get the earliest date. Cat Adoptions:
SELECT Customer.CustomerID, Min(Sale.SaleDate) AS MinOfSaleDate
FROM (Customer INNER JOIN Sale ON Customer.CustomerID =
Sale.CustomerID) INNER JOIN Animal ON Sale.SaleID = Animal.SaleID
WHERE (((Animal.Category)="Cat"))
GROUP BY Customer.CustomerID;
Then compute the total by CustomerID based on the date.
WHERE is easier than a double-join with an inequality:
SELECT CatAdoptions.CustomerID, Sum([Quantity]*[SalePrice]) AS [Value]
FROM CatAdoptions INNER JOIN (Merchandise INNER JOIN
(Sale INNER JOIN SaleItem ON Sale.SaleID = SaleItem.SaleID)
ON Merchandise.ItemID = SaleItem.ItemID) ON CatAdoptions.CustomerID = Sale.CustomerID
WHERE (((Merchandise.Category)="Cat") AND ((Sale.SaleDate)>=[CatAdoptions].[MinOfSaleDate]))
GROUP BY CatAdoptions.CustomerID;
Then you might compute the average of that value.