------------------------------------------------------------------------
-- John David Ayers ----------------------------------------------------
-- November 12, 2009 ---------------------------------------------------
-- Subquery 2 ----------------------------------------------------------
------------------------------------------------------------------------

SELECT ProductName
FROM Products
WHERE RetailPrice = (SELECT (MIN(RetailPrice)) FROM Products);

SELECT CustFirstName + ' ' + CustLastName AS [Customer Name], Orders.OrderNumber AS [Order Number], CONVERT(CHAR(12), Orders.OrderDate, 107) AS [Order Date], Order_Details.ProductNumber AS [Product Number], Order_Details.QuantityOrdered AS [Quantity Ordered]
FROM ((Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID)
INNER JOIN Order_Details ON Orders.OrderNumber = Order_Details.OrderNumber)
WHERE Orders.OrderDate =
(SELECT MAX(OrderDate)
FROM Orders
WHERE Orders.CustomerID = Customers.CustomerID);

SELECT ProductName AS [Product Name]
FROM Products
WHERE ProductNumber IN (SELECT DISTINCT ProductNumber
	FROM Order_Details INNER JOIN Orders ON Order_Details.OrderNumber = Orders.OrderNumber
	WHERE MONTH(OrderDate) = 12);
