2

Answers to Exercises: How to Filter Your Query Results

Question 1

Select PurchaseOrderDetailID, due date, and order quantity for all purchase order detail items whose order quantity is less than  are less than 100

SELECT PurchaseOrderDetailID,
       DueDate,
       OrderQty
FROM   Purchasing.PurchaseOrderDetail
WHERE  OrderQty < 100

Question 2

Select PurchaseOrderDetailID, due date, and order quantity for all purchase order detail items whose order quantity is between 1 and 10

SELECT PurchaseOrderDetailID,
       DueDate,
       OrderQty
FROM   Purchasing.PurchaseOrderDetail
WHERE  OrderQty BETWEEN 1 AND 10

Question 3

Find all persons whose first name is “Ken”

SELECT FirstName,
       LastName
FROM   Person.Person
WHERE  FirstName = 'Ken'

Question 4

Find all productIDs from PurchaseOrders  421, 424, 142

Select ProductID, 
       PurchaseOrderID
From   Purchasing.PurchaseOrderDetail
Where  PurchaseOrderID in (421,424,142)
>