Listing 1: Code That Creates and Populates the EmpOrders Table USE tempdb GO IF OBJECT_ID('EmpOrders') IS NOT NULL DROP TABLE EmpOrders GO CREATE TABLE EmpOrders ( empid int NOT NULL, ordermonth datetime NOT NULL, qty int NOT NULL, PRIMARY KEY(empid, ordermonth, qty) ) INSERT INTO EmpOrders(empid, ordermonth, qty) SELECT O.EmployeeID, CAST(CONVERT(char(6), O.OrderDate, 112) + '01' AS datetime) AS ordermonth, SUM(Quantity) AS qty FROM Northwind.dbo.Orders AS O JOIN Northwind.dbo.[Order Details] AS OD ON O.OrderID = OD.OrderID GROUP BY EmployeeID, CAST(CONVERT(char (6), O.OrderDate, 112) + '01' AS datetime)