Database Reference
In-Depth Information
2.25 Write an SQL statement to display the SKU, SKU_Description, and WarehouseID for
products that have a QuantityOnHand equal to 0. Sort the results in ascending order by
WarehouseID.
2.26 Write an SQL statement to display the SKU, SKU_Description, and WarehouseID for
products that have a QuantityOnHand greater than 0. Sort the results in descending
order by WarehouseID and in ascending order by SKU.
2.27 Write an SQL statement to display SKU, SKU_Description, and WarehouseID for all
products that have a QuantityOnHand equal to 0 and a QuantityOnOrder greater than
0. Sort the results in descending order by WarehouseID and in ascending order by SKU.
2.28 Write an SQL statement to display SKU, SKU_Description, and WarehouseID for all
products that have a QuantityOnHand equal to 0 or a QuantityOnOrder equal to 0. Sort
the results in descending order by WarehouseID and in ascending order by SKU.
2.29 Write an SQL statement to display the SKU, SKU_Description, WarehouseID, and
QuantityOnHand for all products having a QuantityOnHand greater than 1 and less
than 10. Do not use the BETWEEN keyword.
2.30 Write an SQL statement to display the SKU, SKU_Description, WarehouseID, and
QuantityOnHand for all products having a QuantityOnHand greater than 1 and less
than 10. Use the BETWEEN keyword.
2.31 Write an SQL statement to show a unique SKU and SKU_Description for all products
having an SKU description starting with 'Half-dome'.
2.32 Write an SQL statement to show a unique SKU and SKU_Description for all products
having a description that includes the word 'Climb'.
2.33 Write an SQL statement to show a unique SKU and SKU_Description for all products
having a 'd' in the third position from the left in SKU_Description.
2.34 Write an SQL statement that uses all of the SQL built-in functions on the
QuantityOnHand column. Include meaningful column names in the result.
2.35 Explain the difference between the SQL built-in functions COUNT and SUM.
2.36 Write an SQL statement to display the WarehouseID and the sum of QuantityOnHand,
grouped by WarehouseID. Name the sum TotalItemsOnHand. Display the results in
descending order of TotalItemsOnHand.
2.37 Write an SQL statement to display the WarehouseID and the sum of QuantityOnHand,
grouped by WarehouseID. Omit all SKU items that have 3 or more items on hand from
the sum, and name the sum TotalItemsOnHandLT3. Display the results in descending
order of TotalItemsOnHandLT3.
2.38 Write an SQL statement to display the WarehouseID and the sum of QuantityOnHand,
grouped by WarehouseID. Omit all SKU items that have 3 or more items on hand from
the sum, and name the sum TotalItemsOnHandLT3. Show Warehouse ID only for
warehouses having fewer than 2 SKUs in their TotalItemsOnHandLT3. Display the re-
sults in descending order of TotalItemsOnHandLT3.
2.39 In your answer to Review Question 2.38, was the WHERE clause or the HAVING clause
applied first? Why?
Use both the INVeNTORy and WaRehOUSe tables to answer Review Questions 2.40
through 2.55:
2.40 Write an SQL statement to display the SKU, SKU_Description, WarehouseID,
WarehouseCity, and WarehouseState for all items stored in the Atlanta, Bangor, or
Chicago warehouse. Do not use the IN keyword.
2.41 Write an SQL statement to display the SKU, SKU_Description, WarehouseID,
WarehouseCity, and WarehouseState for all items stored in the Atlanta, Bangor, or
Chicago warehouse. Use the IN keyword.
Search WWH ::




Custom Search