LISTING 3: Example of a Subquery Reformatted for Use as a Function CREATE FUNCTION AveragePrice() RETURNS money AS BEGIN RETURN (SELECT AVG(Price) FROM Titles) END GO CREATE FUNCTION PriceDifference(@Price money) RETURNS money AS BEGIN RETURN @Price - dbo.AveragePrice() END